class HelloWorld { public function hello() { \$echo = function(\$msg) { echo \$msg }; \$echo('Hello World'); } } ?> EOD; $this->stream = new TokenStream(['source' => $this->code]); $this->len = count(token_get_all($this->code)); }); describe("->load", function () { it("wraps passed code with PHP tags when the `'wrap'` option is used", function () { $stream = new TokenStream(['source' => 'class HelloWorld {}', 'wrap' => true]); $actual = $stream->current(); expect($actual)->toBe("class"); }); }); describe("->current()", function () { it("gets the current token value", function () { $actual = $this->stream->current(); expect($actual)->toBe("<?php\n"); }); it("gets the current token", function () { $actual = $this->stream->current(true); expect($actual)->toBe([T_OPEN_TAG, "<?php\n", 1]); }); }); describe("->next()", function () { it("moves next", function () {