public function testCreatedStatesAreEqualButNotTheSame()
{
$targetCollection = new StateCollection();
$merger = new StateCollectionMerger($targetCollection);
$sourceCollection = $this->createSourceCollection();
$merger->merge($sourceCollection);
/* @var $sourceState State */
foreach ($sourceCollection->getStates() as $sourceState) {
/* @var $targetState State */
$targetState = $targetCollection->getState($sourceState->getName());
$this->assertNotSame($sourceState, $targetState);
$this->assertSameSize($sourceState->getTransitions(), $targetState->getTransitions());
$this->assertEquals($sourceState->getEventNames(), $targetState->getEventNames());
foreach ($sourceState->getEventNames() as $eventName) {
$this->assertTrue($targetState->hasEvent($eventName));
$sourceEvent = $sourceState->getEvent($eventName);
$targetEvent = $targetState->getEvent($eventName);
$this->assertNotSame($sourceEvent, $targetEvent);
$this->assertEquals($sourceEvent->getMetadata(), $targetEvent->getMetadata());
$this->assertEquals($sourceEvent->getObservers(), $targetEvent->getObservers());
}
$this->assertEquals($sourceState->getMetadata(), $targetState->getMetadata());
}
}