/** * @test */ public function raisesAnExceptionIfTheEventIdIsInvalidWhenSettingTheDoEvent() { $state = new State('foo'); try { $state->setDoEvent(new TransitionEvent('bar')); } catch (InvalidEventException $e) { return; } $this->fail('An expected exception has not been raised.'); }
/** * Adds a state to the state machine. * * @param string $stateId */ public function addState($stateId) { $state = new State($stateId); $state->setEntryEvent(new EntryEvent()); $state->setExitEvent(new ExitEvent()); $state->setDoEvent(new DoEvent()); $this->stateMachine->addState($state); }