/** * {@inheritdoc} */ public function createItem(EntityId $entityId, $entity) { $stateHistory = $this->stateRepository->find($entityId); return Item::reconstitute($entityId, $entity, $stateHistory); }
function it_creates_an_item(EntityId $entityId, EntityId $entityId, StateRepository $stateRepository, State $state) { $stateRepository->find($entityId)->willReturn(array($state)); $this->createItem($entityId, static::$entity)->shouldHaveType('Netzmacht\\Workflow\\Flow\\Item'); }