it("bails out nicely if there's no further tags", function () {
$stream = new TokenStream(['source' => '']);
$actual = $stream->nextMatchingBracket();
expect($actual)->toBe(null);
});
it("bails out nicely if the current tags is not an open tags", function () {
$stream = new TokenStream(['source' => '<?php ?>']);
$actual = $stream->nextMatchingBracket();
expect($actual)->toBe(null);
});
it("cancels the lookup if there's no closing tags", function () {
$stream = new TokenStream(['source' => '<?php { { } ?>']);
$stream->next('{');
$actual = $stream->nextMatchingBracket();
expect($actual)->toBe(null);
expect($stream->getValue())->toBe('{');
});
});
describe("->prev()", function () {
it("moves prev", function () {
$key = $this->stream->key();
$this->stream->next();
$this->stream->prev();
expect($key)->not->toBe($this->stream->current());
});
it("gets the previous token value", function () {
$this->stream->seek(1);
$actual = $this->stream->prev();
expect($actual)->toBe("<?php\n");
});
it("gets the previous token", function () {