示例#1
0
 /**
  * @param int $tokenAmount
  * @dataProvider providerTokenAmount
  */
 public function testNotIsEndAfterAddingToken(int $tokenAmount)
 {
     $buffer = TokenBuffer::factory();
     for ($i = 0; $i < $tokenAmount; $i++) {
         $token = Token::factory(Token::TYPE_SLASH, "/", 1);
         $buffer->addToken($token);
     }
     $this->assertFalse($buffer->isEnd(), "End condition after adding token to buffer");
 }
示例#2
0
 /**
  * @expectedException \LogicException
  */
 public function testUninitializedUnreadingThrowsSplException()
 {
     TokenBuffer::factory()->unreadToken();
 }
示例#3
0
 /**
  * Returns token buffer.
  *
  * @return TokenBuffer
  */
 protected function getBuffer() : TokenBuffer
 {
     if (null === $this->buffer) {
         $this->buffer = TokenBuffer::factory();
     }
     return $this->buffer;
 }