function it_throws_an_exception_if_the_transition_is_not_defined(Symbol $symbol1, Symbol $symbol2, State $state1, State $state2) { $symbol1->matches($symbol1)->willReturn(true); $symbol1->matches($symbol2)->willReturn(false); $symbol2->matches($symbol1)->willReturn(false); $symbol2->matches($symbol2)->willReturn(true); $this->on($symbol1)->visit($state1); $this->shouldThrow(TransitionNotDefinedException::class)->duringGetReachableStateBySymbol($symbol2); }
function it_returns_all_the_reachable_symbols_once_except_Epsilon(Symbol $symbol1, Symbol $symbol2) { $symbol1->matches($symbol1)->willReturn(true); $symbol1->matches($symbol2)->willReturn(false); $symbol2->matches($symbol1)->willReturn(false); $symbol2->matches($symbol2)->willReturn(true); $this->on(EpsilonSymbol::create()); $this->on($symbol1); $this->on($symbol2); $this->on($symbol1); $this->getReachableSymbols()->shouldReturn([$symbol1, $symbol2]); }
function it_returns_all_the_reachable_symbols(State $state1, State $state2, State $state3, State $state4, Symbol $symbol1, Symbol $symbol2) { $symbol1->matches($symbol1)->willReturn(true); $symbol1->matches($symbol2)->willReturn(false); $symbol2->matches($symbol1)->willReturn(false); $symbol2->matches($symbol2)->willReturn(true); $state1->getReachableSymbols()->willReturn([$symbol1]); $state2->getReachableSymbols()->willReturn([$symbol1, $symbol2]); $state3->getReachableSymbols()->willReturn([$symbol2]); $state4->getReachableSymbols()->willReturn([]); $this->getReachableSymbols()->shouldReturn([$symbol1, $symbol2]); }
/** * @param Symbol $symbol * * @return bool */ public function isGranted(Symbol $symbol) { return $this->symbol->matches($symbol); }
function it_does_not_grant_permission_to_a_symbol_if_the_symbol_does_not_match_it(Symbol $symbol, Symbol $other) { $symbol->matches($other)->willReturn(false); $this->shouldNotBeGranted($other); }