/** * @test */ public function it_creates_a_sequence_with_a_range_expectation() { $sequence = SequenceBuilder::create()->lookingBackward()->expect()->quantity()->atLeast(2)->atMost(4)->token(T_WHITESPACE, "\n")->end()->end()->build(); $expectedSequence = new BackwardSequence(); $expectedSequence->addExpectation(new Quantity(new ExactMatch(T_WHITESPACE, "\n"), 2, 4)); $this->assertEquals($expectedSequence, $sequence); }
/** * @test */ public function it_fails_when_peek_is_called_but_end_of_sequence_is_reached() { $forwardSequence = new BackwardSequence(); $this->setExpectedException('Matthias\\Codesniffer\\Sequence\\Exception\\EndOfSequence'); $forwardSequence->peek(); }