function it_can_be_converted_to_a_DFA(State $state, Symbol $symbol) { $state->getReachableStatesBySymbol(Argument::type(EpsilonSymbol::class))->willReturn([]); $state->getReachableSymbols()->willReturn([]); $state->isFinal()->willReturn(false); $this->addStartingState($state); $this->toDFA()->shouldBeAnInstanceOf(DFA::class); }
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]); }