getStateMachineTransition() public method

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function apply(RequestConfiguration $configuration, ResourceInterface $resource)
 {
     if (!$configuration->hasStateMachine()) {
         throw new \InvalidArgumentException('State machine must be configured to apply transition, check your routing.');
     }
     $this->stateMachineFactory->get($resource, $configuration->getStateMachineGraph())->apply($configuration->getStateMachineTransition());
 }
Example #2
0
 function it_applies_configured_state_machine_transition(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FactoryInterface $stateMachineFactory, StateMachineInterface $stateMachine)
 {
     $requestConfiguration->hasStateMachine()->willReturn(true);
     $requestConfiguration->getStateMachineGraph()->willReturn('sylius_product_review_state');
     $requestConfiguration->getStateMachineTransition()->willReturn('reject');
     $stateMachineFactory->get($resource, 'sylius_product_review_state')->willReturn($stateMachine);
     $stateMachine->apply('reject')->shouldBeCalled();
     $this->apply($requestConfiguration, $resource);
 }