$axesBefore =
$this->
getContainer([1 => 'second', 3 => 'fourth', 4 => 'fifth'
]);
$axesMerged =
$this->
getContainer([1 => 'first', 2 => 'second', 3 => 'third'
]);
$axesAfter =
$this->
getContainer([1 => 'second', 5 => 'first', 6 => 'third'
]);
$axesMergedCopy = \
is_object($axesMerged) ?
clone $axesMerged :
$axesMerged;
// Don't use a mock in order to test whether the collections are
// modified while iterating them
$car =
new PropertyAccessorCollectionTestCase_Car($axesBefore);
$this->propertyAccessor->
setValue($car, 'axes',
$axesMerged);
$this->
assertEquals($axesAfter,
$car->
getAxes());
// The passed collection was not modified
$this->
assertEquals($axesMergedCopy,
$axesMerged);
} public function testSetValueCallsAdderAndRemoverForNestedCollections() { $car =
$this->
createMock(__CLASS__.'_CompositeCar'
);
$structure =
$this->
createMock(__CLASS__.'_CarStructure'
);
$axesBefore =
$this->
getContainer([1 => 'second', 3 => 'fourth'
]);
$axesAfter =
$this->
getContainer([0 => 'first', 1 => 'second', 2 => 'third'
]);