function it_creates_the_repository_based_transition_handler(Item $item, Workflow $workflow, StateRepository $stateRepository, EntityManager $entityManager, EntityRepository $entityRepository, Listener $listener) { $entityManager->getRepository('test')->willReturn($entityRepository); $item->isWorkflowStarted()->willReturn(false); $item->getEntity()->willReturn(static::$entity); $this->setListener($listener); $this->createTransitionHandler($item, $workflow, null, 'test', $stateRepository)->shouldHaveType('Netzmacht\\Workflow\\Handler\\RepositoryBasedTransitionHandler'); }
/** * Create a transition handler. * * @param Item $item Workflow item. * @param Workflow $workflow Workflow definition. * @param string $transitionName Transition name. * @param string $providerName Provider name. * @param StateRepository $stateRepository The state repository. * * @return TransitionHandler */ public function createTransitionHandler(Item $item, Workflow $workflow, $transitionName, $providerName, StateRepository $stateRepository) { return new RepositoryBasedTransitionHandler($item, $workflow, $transitionName, $this->entityManager->getRepository($providerName), $stateRepository, $this->transactionHandler, $this->getListener()); }