/**
  * @test
  * @dataProvider tokensProvider
  */
 public function it_walks_forward_over_an_array_of_tokens($tokens, $tokenIndex, $expectedTokens)
 {
     $forwardSequence = new ForwardSequence();
     $expectationSpy = new Spy();
     $forwardSequence->addExpectation($expectationSpy);
     $forwardSequence->matches($tokens, $tokenIndex);
     $this->assertEquals($expectedTokens, $expectationSpy->getTokens());
 }
 /**
  * @test
  * @dataProvider tokensProvider
  */
 public function it_matches_a_complicated_set_of_expectations(array $expectations, array $tokens, $expectedToMatch)
 {
     $sequence = new ForwardSequence($expectations);
     $this->assertSame($expectedToMatch, $sequence->matches($tokens, 0));
 }
 /**
  * @test
  * @dataProvider tokensProvider
  */
 public function it_matches_a_number_of_tokens(ExpectationInterface $innerExpectation, $minimum, $maximum, array $tokens, $tokenIndex, $expectedToMatch)
 {
     $sequence = new ForwardSequence();
     $sequence->addExpectation(new Quantity($innerExpectation, $minimum, $maximum));
     $this->assertSame($expectedToMatch, $sequence->matches($tokens, $tokenIndex));
 }
 /**
  * @test
  * @dataProvider tokensProvider
  */
 public function it_matches_succeeding_tokens(array $expectations, array $tokens, $tokenIndex, $expectedToMatch)
 {
     $sequence = new ForwardSequence(array(new Succeeding($expectations)));
     $this->assertSame($expectedToMatch, $sequence->matches($tokens, $tokenIndex));
 }
 /**
  * @test
  * @dataProvider tokensProvider
  */
 public function it_matches_exactly_one_token($tokens, $tokenIndex, $expectedToMatch)
 {
     $sequence = new ForwardSequence();
     $sequence->addExpectation(new ExactMatch(T_WHITESPACE));
     $this->assertSame($expectedToMatch, $sequence->matches($tokens, $tokenIndex));
 }