/** * */ public function testFiltersStatesThatHaveNoOutgoingTransitions() { $eventName = 'event'; $stateCollection = new StateCollection(); $helper = new SetupHelper($stateCollection); $helper->findOrCreateTransition('foo', 'bar', $eventName); $filter = new FilterStateByFinalState($stateCollection->getStates()); $filteredStates = iterator_to_array($filter); $this->assertContains($stateCollection->getState('bar'), $filteredStates); $this->assertNotContains($stateCollection->getState('foo'), $filteredStates); }
/** * */ public function testFiltersStatesThatHaveTransitionsWithoutAnEvent() { $eventName = 'event'; $stateCollection = new StateCollection(); $helper = new SetupHelper($stateCollection); $helper->findOrCreateTransition('foo', 'bar', $eventName); $helper->findOrCreateTransition('bar', 'baz', null, new Tautology('condition')); $filter = new FilterStateByTransition($stateCollection->getStates()); $filteredStates = iterator_to_array($filter); $this->assertNotContains($stateCollection->getState('foo'), $filteredStates); $this->assertContains($stateCollection->getState('bar'), $filteredStates); $this->assertNotContains($stateCollection->getState('baz'), $filteredStates); }
/** * @see MetaborStd\Statemachine.ProcessInterface::getStates() */ public function getStates() { return $this->states->getStates(); }