public function setUp() { $this->machine = new StateMachine(); $stateScheduled = new State(Visit::SCHEDULED); $stateScheduled->addTransition('do', Visit::SCHEDULED, Visit::IN_PROGRESS); $stateProgress = new State(Visit::IN_PROGRESS); $stateProgress->putTransition(new Transition('reset', Visit::IN_PROGRESS, Visit::SCHEDULED)); $this->machine->addState($stateScheduled); $this->machine->addState($stateProgress); }
/** * @inheritdoc */ public function addState(State $state) { $this->states[$state->getName()] = $state; }