New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace usage of deprecated $canonicalize phpunit parameter #238
Changes from 4 commits
64c6968
9f530d2
aa180fc
395edd8
7a3c173
c51c433
c6717b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ class AllergiesTest extends PHPUnit\Framework\TestCase | |
|
||
/** | ||
* @dataProvider provideListOfAllergen | ||
* | ||
* @param Allergen $allergen | ||
*/ | ||
public function testNoAllergiesMeansNotAllergicToAnything($allergen) | ||
{ | ||
|
@@ -17,6 +19,8 @@ public function testNoAllergiesMeansNotAllergicToAnything($allergen) | |
|
||
/** | ||
* @dataProvider provideListOfAllergen | ||
* | ||
* @param Allergen $allergicTo | ||
*/ | ||
public function testAllergiesToOneAllergen($allergicTo) | ||
{ | ||
|
@@ -26,7 +30,7 @@ public function testAllergiesToOneAllergen($allergicTo) | |
$otherAllergen = array_filter(Allergen::allergenList(), function ($allergen) use ($allergicTo) { | ||
return $allergen != $allergicTo; | ||
}); | ||
$self = $this; | ||
$self = $this; | ||
array_map(function ($allergen) use ($allergies, $self) { | ||
$self->assertFalse($allergies->isAllergicTo($allergen)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm this is weird, passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prior to PHP 5.4 It should probably be removed now, however, as 5.4 has been EOL'd for four years. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if you guys want me to remove this :) Also: Hi Ross! :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense to remove it, as it's bad practice now and the tests are something students should be looking at while they're working through a problem. Thoughts @petemcfarlane? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah 💯 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you guys want this change, could you please request it? (i.e review with "changes requested") /cc @DerTee |
||
}, $otherAllergen); | ||
|
@@ -58,48 +62,48 @@ public function testIsAllergicToLotsOfStuffs() | |
{ | ||
$allergies = new Allergies(248); | ||
|
||
$this->assertEquals([ | ||
$this->assertEqualsCanonicalizing([ | ||
new Allergen(Allergen::CATS), | ||
new Allergen(Allergen::CHOCOLATE), | ||
new Allergen(Allergen::POLLEN), | ||
new Allergen(Allergen::STRAWBERRIES), | ||
new Allergen(Allergen::TOMATOES), | ||
], $allergies->getList(), "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true); | ||
], $allergies->getList()); | ||
} | ||
|
||
public function testIsAllergicToEggsAndPeanuts() | ||
{ | ||
$allergies = new Allergies(3); | ||
|
||
$this->assertEquals([ | ||
$this->assertEqualsCanonicalizing([ | ||
new Allergen(Allergen::EGGS), | ||
new Allergen(Allergen::PEANUTS), | ||
], $allergies->getList(), "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true); | ||
], $allergies->getList()); | ||
} | ||
|
||
public function testIsAllergicToEgssAndShellfish() | ||
public function testIsAllergicToEggsAndShellfish() | ||
{ | ||
$allergies = new Allergies(5); | ||
|
||
$this->assertEquals([ | ||
$this->assertEqualsCanonicalizing([ | ||
new Allergen(Allergen::EGGS), | ||
new Allergen(Allergen::SHELLFISH), | ||
], $allergies->getList(), "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true); | ||
], $allergies->getList()); | ||
} | ||
|
||
public function testIgnoreNonAllergenScorePart() | ||
{ | ||
$allergies = new Allergies(509); | ||
|
||
$this->assertEquals([ | ||
$this->assertEqualsCanonicalizing([ | ||
new Allergen(Allergen::CATS), | ||
new Allergen(Allergen::CHOCOLATE), | ||
new Allergen(Allergen::EGGS), | ||
new Allergen(Allergen::POLLEN), | ||
new Allergen(Allergen::SHELLFISH), | ||
new Allergen(Allergen::STRAWBERRIES), | ||
new Allergen(Allergen::TOMATOES), | ||
], $allergies->getList(), "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true); | ||
], $allergies->getList()); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can we remove this temporary variable
$self
, as it's no longer necessary