public function testIssue30() { $states = ['state1' => new State('state1', StateInterface::TYPE_INITIAL), 'state2' => new State('state2'), 'state2' => new State('state3', StateInterface::TYPE_FINAL)]; $transitions = ['state1' => ['_sequential' => [new Transition('state1', 'state2')]], 'state2' => ['_sequential' => [new Transition('state2', 'state3')]]]; $subject = new GenericSubject('test_machine'); $state_machine = new StateMachine('test_machine', $states, $transitions); $suspend_state = $state_machine->execute($subject); $this->assertEquals('state3', $suspend_state->getName()); }
/** * Overrides the "StateMachine::enterState" method, * in order to support/emit the ON_STATE_ENTERED event. * * @param StatefulSubjectInterface $subject * @param StateInterface $current_state */ protected function enterState(StatefulSubjectInterface $subject, StateInterface $next_state) { parent::enterState($subject, $next_state); $this->fireEvent(self::ON_STATE_ENTERED, $subject, $next_state); }