-
Notifications
You must be signed in to change notification settings - Fork 77
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
Possible implementation for #62 and temporary workaround for #63 #64
Possible implementation for #62 and temporary workaround for #63 #64
Conversation
…ound for PhpUnitsOfMeasure#63 (necessary for PhpUnitsOfMeasure#62 unit tests)
…, this fix mocks out UnitOfMeasureInterface::isAliasOf() for the AbstractPhysicalQuantityTest unit test mock.
source/AbstractPhysicalQuantity.php
Outdated
*/ | ||
public static function listAllUnits() | ||
{ | ||
$return = array(); |
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.
let's not mix styles, []
instead of array()
@@ -71,4 +71,23 @@ public function subtract(PhysicalQuantityInterface $quantity); | |||
* @return boolean True if the quantities are the same, false if not. | |||
*/ | |||
public function isEquivalentQuantity(PhysicalQuantityInterface $testQuantity); | |||
|
|||
/** |
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.
These both look like good additions.
$unexistingUnits = array('kg', 'l', 'definitelynoconflict_'); | ||
|
||
foreach ($someExistingUnits as $someExistingUnit) { | ||
$this->assertTrue(Wonkicity::isUnitDefined($someExistingUnit)); |
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.
Let's do a comment in the assertion, so we can tell which test failed. As this is here, it'll just error with "true should be false" or something like that. If it were like this, you'll get more explanation when the test fails:
foreach ($someExistingUnits as $someExistingUnit) {
$this->assertTrue(Wonkicity::isUnitDefined($someExistingUnit), "$someExistingUnit is not defined");
}
foreach ($unexistingUnits as $unexistingUnit) {
$this->assertFalse(Wonkicity::isUnitDefined($unexistingUnit), "$unexistingUnit is defined");
}
$newUnit = $this->getTestUnitOfMeasureSafe('noconflict', ['definitelynoconflict_1', 'definitelynoconflict_2']); | ||
Wonkicity::addUnit($newUnit); | ||
|
||
$someExistingUnits = array('u', 'uvees', 'v', 'vorp', 'noconflict', 'definitelynoconflict_1', 'definitelynoconflict_2'); |
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.
Similarly here and on 257, let's use [] instead of array().
Wonkicity::addUnit($newUnit); | ||
|
||
$allUnits = Wonkicity::listAllUnits(); | ||
$expected = array( |
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.
Similar to above, [] instead of array().
Hi, Now everything should be ok, and tests pass. I also manually put here the code of the #65 (I don't see it in the master) in order to allow tests to pass. I hope it's ok. Thanks |
Hi, any news about? |
Hello, and sorry for the long delay. This looks good now, I'm ok with merging it. Thanks again for your contribution. |
Possible implementation for #62 and temporary workaround for #63 (necessary for #62 unit tests)