mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
Simplify tests: Avoid to remove random value
This commit is contained in:
@@ -42,9 +42,6 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
|
||||
$colorGold = new Value($attribute);
|
||||
$colorGold->setName('Gold');
|
||||
$values[] = $colorGold;
|
||||
$colorSpaceGrey = new Value($attribute);
|
||||
$colorSpaceGrey->setName('Space Grey');
|
||||
$values[] = $colorSpaceGrey;
|
||||
|
||||
$this->assertEquals($values, $attribute->getValues());
|
||||
}
|
||||
@@ -65,13 +62,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
|
||||
$colorGold = new Value($attribute);
|
||||
$colorGold->setName('Gold');
|
||||
$values[] = $colorGold;
|
||||
$colorSpaceGrey = new Value($attribute);
|
||||
$colorSpaceGrey->setName('Space Grey');
|
||||
$values[] = $colorSpaceGrey;
|
||||
|
||||
$randomIndex = array_rand($values);
|
||||
$attribute->removeValue($values[$randomIndex]);
|
||||
unset($values[$randomIndex]);
|
||||
$attribute->removeValue($values[0]);
|
||||
unset($values[0]);
|
||||
|
||||
$this->assertEquals($values, $attribute->getValues());
|
||||
}
|
||||
|
@@ -58,9 +58,8 @@ class EntityTest extends \PHPUnit_Framework_TestCase
|
||||
$macBook->addValue($value);
|
||||
}
|
||||
|
||||
$randomIndex = array_rand($values);
|
||||
$macBook->removeValue($values[$randomIndex]);
|
||||
unset($values[$randomIndex]);
|
||||
$macBook->removeValue($values[0]);
|
||||
unset($values[0]);
|
||||
|
||||
$this->assertEquals($values, $macBook->getValues());
|
||||
}
|
||||
|
Reference in New Issue
Block a user