/** * @param StateMachineInterface $stateMachine * @param string $transition */ private function applyTransition(StateMachineInterface $stateMachine, $transition) { if ($stateMachine->can($transition)) { $stateMachine->apply($transition); } }
function it_provide_sm_can_function(FactoryInterface $factory, StateMachineInterface $stateMachine) { $this->can($object = new DummyObject(), 'new', 'simple'); $factory->get($object, 'simple')->shouldHaveBeenCalled(); $stateMachine->can('new')->shouldHaveBeenCalled(); }