/** * @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"); }
/** * @expectedException \LogicException */ public function testUninitializedUnreadingThrowsSplException() { TokenBuffer::factory()->unreadToken(); }
/** * Returns token buffer. * * @return TokenBuffer */ protected function getBuffer() : TokenBuffer { if (null === $this->buffer) { $this->buffer = TokenBuffer::factory(); } return $this->buffer; }