Simplify tests: Avoid to remove random value

This commit is contained in:
victor
2015-08-25 10:08:49 +03:00
parent cf0a0b353b
commit 47c323d36b
2 changed files with 4 additions and 12 deletions

View File

@@ -42,9 +42,6 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
$colorGold = new Value($attribute); $colorGold = new Value($attribute);
$colorGold->setName('Gold'); $colorGold->setName('Gold');
$values[] = $colorGold; $values[] = $colorGold;
$colorSpaceGrey = new Value($attribute);
$colorSpaceGrey->setName('Space Grey');
$values[] = $colorSpaceGrey;
$this->assertEquals($values, $attribute->getValues()); $this->assertEquals($values, $attribute->getValues());
} }
@@ -65,13 +62,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
$colorGold = new Value($attribute); $colorGold = new Value($attribute);
$colorGold->setName('Gold'); $colorGold->setName('Gold');
$values[] = $colorGold; $values[] = $colorGold;
$colorSpaceGrey = new Value($attribute);
$colorSpaceGrey->setName('Space Grey');
$values[] = $colorSpaceGrey;
$randomIndex = array_rand($values); $attribute->removeValue($values[0]);
$attribute->removeValue($values[$randomIndex]); unset($values[0]);
unset($values[$randomIndex]);
$this->assertEquals($values, $attribute->getValues()); $this->assertEquals($values, $attribute->getValues());
} }

View File

@@ -58,9 +58,8 @@ class EntityTest extends \PHPUnit_Framework_TestCase
$macBook->addValue($value); $macBook->addValue($value);
} }
$randomIndex = array_rand($values); $macBook->removeValue($values[0]);
$macBook->removeValue($values[$randomIndex]); unset($values[0]);
unset($values[$randomIndex]);
$this->assertEquals($values, $macBook->getValues()); $this->assertEquals($values, $macBook->getValues());
} }