Fix PHPUnit deprecations

This commit is contained in:
Fabien Potencier
2019-08-08 10:31:09 +02:00
parent c829dafd75
commit 5ebcecf24b
16 changed files with 73 additions and 75 deletions
+3 -3
View File
@@ -81,7 +81,7 @@ class FilesystemTest extends TestCase
public function testWriteFailMkdir()
{
$this->expectException('\RuntimeException');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Unable to create the cache directory');
if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
@@ -102,7 +102,7 @@ class FilesystemTest extends TestCase
public function testWriteFailDirWritable()
{
$this->expectException('\RuntimeException');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Unable to write in the cache directory');
if (\defined('PHP_WINDOWS_VERSION_BUILD')) {
@@ -125,7 +125,7 @@ class FilesystemTest extends TestCase
public function testWriteFailWriteFile()
{
$this->expectException('\RuntimeException');
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Failed to write cache file');
$key = $this->directory.'/cache/cachefile.php';
+1 -1
View File
@@ -23,7 +23,7 @@ class CustomExtensionTest extends TestCase
*/
public function testGetInvalidOperators(ExtensionInterface $extension, $expectedExceptionMessage)
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage($expectedExceptionMessage);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
+7 -8
View File
@@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
use Twig\Cache\CacheInterface;
use Twig\Cache\FilesystemCache;
use Twig\Environment;
use Twig\Error\RuntimeError;
use Twig\Extension\AbstractExtension;
use Twig\Extension\ExtensionInterface;
use Twig\Extension\GlobalsInterface;
@@ -323,12 +324,11 @@ class EnvironmentTest extends TestCase
$this->addToAssertionCount(1);
}
/**
* @expectedException \LogicException
* @expectedExceptionMessage Unable to register extension "Twig\Tests\EnvironmentTest_Extension" as it is already registered.
*/
public function testOverrideExtension()
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Unable to register extension "Twig\Tests\EnvironmentTest_Extension" as it is already registered.');
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$twig->addExtension(new EnvironmentTest_Extension());
@@ -361,12 +361,11 @@ class EnvironmentTest extends TestCase
$this->assertEquals('foo', $twig->render('func_string_named_args'));
}
/**
* @expectedException \Twig\Error\RuntimeError
* @expectedExceptionMessage Failed to load Twig template "testFailLoadTemplate.twig", index "112233": cache might be corrupted in "testFailLoadTemplate.twig".
*/
public function testFailLoadTemplate()
{
$this->expectException(RuntimeError::class);
$this->expectExceptionMessage('Failed to load Twig template "testFailLoadTemplate.twig", index "112233": cache might be corrupted in "testFailLoadTemplate.twig".');
$template = 'testFailLoadTemplate.twig';
$twig = new Environment(new ArrayLoader([$template => false]));
$twig->loadTemplate($template, 112233);
+14 -13
View File
@@ -13,6 +13,7 @@ namespace Twig\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\SyntaxError;
use Twig\Loader\LoaderInterface;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\Binary\ConcatBinary;
@@ -28,7 +29,7 @@ class ExpressionParserTest extends TestCase
*/
public function testCanOnlyAssignToNames($template)
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
$parser = new Parser($env);
@@ -71,7 +72,7 @@ class ExpressionParserTest extends TestCase
*/
public function testArraySyntaxError($template)
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
$parser = new Parser($env);
@@ -164,7 +165,7 @@ class ExpressionParserTest extends TestCase
public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]);
$stream = $env->tokenize(new Source('{{ "a" "b" }}', 'index'));
@@ -235,7 +236,7 @@ class ExpressionParserTest extends TestCase
public function testAttributeCallDoesNotSupportNamedArguments()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
$parser = new Parser($env);
@@ -245,7 +246,7 @@ class ExpressionParserTest extends TestCase
public function testMacroCallDoesNotSupportNamedArguments()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
$parser = new Parser($env);
@@ -255,7 +256,7 @@ class ExpressionParserTest extends TestCase
public function testMacroDefinitionDoesNotSupportNonNameVariableName()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1.');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -269,7 +270,7 @@ class ExpressionParserTest extends TestCase
*/
public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template)
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -316,7 +317,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownFunction()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "cycl" function. Did you mean "cycle" in "index" at line 1?');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -327,7 +328,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownFunctionWithoutSuggestions()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "foobar" function in "index" at line 1.');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -338,7 +339,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownFilter()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "lowe" filter. Did you mean "lower" in "index" at line 1?');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -349,7 +350,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownFilterWithoutSuggestions()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "foobar" filter in "index" at line 1.');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -360,7 +361,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownTest()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "nul" test. Did you mean "null" in "index" at line 1');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
@@ -371,7 +372,7 @@ class ExpressionParserTest extends TestCase
public function testUnknownTestWithoutSuggestions()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "foobar" test in "index" at line 1.');
$env = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock(), ['cache' => false, 'autoescape' => false]);
+2 -1
View File
@@ -13,6 +13,7 @@ namespace Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\RuntimeError;
use Twig\Loader\LoaderInterface;
class CoreTest extends TestCase
@@ -99,7 +100,7 @@ class CoreTest extends TestCase
public function testRandomFunctionOfEmptyArrayThrowsException()
{
$this->expectException('\Twig\Error\RuntimeError');
$this->expectException(RuntimeError::class);
twig_random(new Environment($this->getMockBuilder(LoaderInterface::class)->getMock()), []);
}
+3 -3
View File
@@ -13,6 +13,7 @@ namespace Twig\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\RuntimeError;
use Twig\Extension\EscaperExtension;
use Twig\Loader\LoaderInterface;
@@ -358,11 +359,10 @@ class Twig_Tests_Extension_EscaperTest extends TestCase
];
}
/**
* @expectedException \Twig\Error\RuntimeError
*/
public function testUnknownCustomEscaper()
{
$this->expectException(RuntimeError::class);
twig_escape_filter(new Environment($this->getMockBuilder(LoaderInterface::class)->getMock()), 'foo', 'bar');
}
+1 -1
View File
@@ -55,7 +55,7 @@ class SandboxTest extends TestCase
public function testSandboxWithInheritance()
{
$this->expectException('\Twig\Sandbox\SecurityError');
$this->expectException(SecurityError::class);
$this->expectExceptionMessage('Filter "json_encode" is not allowed in "1_child" at line 3.');
$twig = $this->getEnvironment(true, [], self::$templates, ['block']);
+4 -3
View File
@@ -13,6 +13,7 @@ namespace Twig\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\SyntaxError;
use Twig\Lexer;
use Twig\Loader\LoaderInterface;
use Twig\Source;
@@ -239,7 +240,7 @@ class LexerTest extends TestCase
public function testStringWithUnterminatedInterpolation()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unclosed """');
$template = '{{ "bar #{x" }}';
@@ -308,7 +309,7 @@ class LexerTest extends TestCase
public function testUnterminatedVariable()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unclosed "variable" in "index" at line 3');
$template = '
@@ -326,7 +327,7 @@ bar
public function testUnterminatedBlock()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unclosed "block" in "index" at line 3');
$template = '
+4 -6
View File
@@ -12,16 +12,14 @@ namespace Twig\Tests\Loader;
*/
use PHPUnit\Framework\TestCase;
use Twig\Error\LoaderError;
use Twig\Loader\ArrayLoader;
class ArrayTest extends TestCase
{
/**
* @expectedException \Twig\Error\LoaderError
*/
public function testGetSourceContextWhenTemplateDoesNotExist()
{
$this->expectException('\Twig\Error\LoaderError');
$this->expectException(LoaderError::class);
$loader = new ArrayLoader([]);
@@ -59,7 +57,7 @@ class ArrayTest extends TestCase
public function testGetCacheKeyWhenTemplateDoesNotExist()
{
$this->expectException('\Twig\Error\LoaderError');
$this->expectException(LoaderError::class);
$loader = new ArrayLoader([]);
@@ -82,7 +80,7 @@ class ArrayTest extends TestCase
public function testIsFreshWhenTemplateDoesNotExist()
{
$this->expectException('\Twig\Error\LoaderError');
$this->expectException(LoaderError::class);
$loader = new ArrayLoader([]);
+3 -2
View File
@@ -12,6 +12,7 @@ namespace Twig\Tests\Loader;
*/
use PHPUnit\Framework\TestCase;
use Twig\Error\LoaderError;
use Twig\Loader\ArrayLoader;
use Twig\Loader\ChainLoader;
use Twig\Loader\FilesystemLoader;
@@ -42,7 +43,7 @@ class ChainTest extends TestCase
public function testGetSourceContextWhenTemplateDoesNotExist()
{
$this->expectException('\Twig\Error\LoaderError');
$this->expectException(LoaderError::class);
$loader = new ChainLoader([]);
@@ -62,7 +63,7 @@ class ChainTest extends TestCase
public function testGetCacheKeyWhenTemplateDoesNotExist()
{
$this->expectException('\Twig\Error\LoaderError');
$this->expectException(LoaderError::class);
$loader = new ChainLoader([]);
+1 -1
View File
@@ -157,7 +157,7 @@ class FilesystemTest extends TestCase
$loader->getSourceContext('@named/nowhere.html');
} catch (\Exception $e) {
$this->assertInstanceOf(LoaderError::class, $e);
$this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage());
$this->assertStringContainsString('Unable to find template "@named/nowhere.html"', $e->getMessage());
}
}
+9 -8
View File
@@ -12,6 +12,7 @@ namespace Twig\Tests\Node\Expression;
*/
use PHPUnit\Framework\TestCase;
use Twig\Error\SyntaxError;
use Twig\Node\Expression\CallExpression;
class CallTest extends TestCase
@@ -24,7 +25,7 @@ class CallTest extends TestCase
public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Positional arguments cannot be used after named arguments for function "date".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
@@ -33,7 +34,7 @@ class CallTest extends TestCase
public function testGetArgumentsWhenArgumentIsDefinedTwice()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Argument "format" is defined twice for function "date".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
@@ -42,7 +43,7 @@ class CallTest extends TestCase
public function testGetArgumentsWithWrongNamedArgumentName()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown argument "unknown" for function "date(format, timestamp)".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
@@ -51,7 +52,7 @@ class CallTest extends TestCase
public function testGetArgumentsWithWrongNamedArgumentNames()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'date']);
@@ -60,7 +61,7 @@ class CallTest extends TestCase
public function testResolveArgumentsWithMissingValueForOptionalArgument()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'substr_compare']);
@@ -82,7 +83,7 @@ class CallTest extends TestCase
public function testResolveArgumentsWithMissingParameterForArbitraryArguments()
{
$this->expectException('\LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('The last parameter of "Twig\\Tests\\Node\\Expression\\CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []".');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
@@ -111,7 +112,7 @@ class CallTest extends TestCase
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction()
{
$this->expectException('\LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessageRegExp('#^The last parameter of "Twig\\\\Tests\\\\Node\\\\Expression\\\\custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\\. "array \\$arg \\= \\[\\]"\\.$#');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
@@ -120,7 +121,7 @@ class CallTest extends TestCase
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject()
{
$this->expectException('\LogicException');
$this->expectException(\LogicException::class);
$this->expectExceptionMessageRegExp('#^The last parameter of "Twig\\\\Tests\\\\Node\\\\Expression\\\\CallableTestClass\\:\\:__invoke" for function "foo" must be an array with default value, eg\\. "array \\$arg \\= \\[\\]"\\.$#');
$node = new Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]);
+3 -2
View File
@@ -12,6 +12,7 @@ namespace Twig\Tests\Node\Expression;
*/
use Twig\Environment;
use Twig\Error\SyntaxError;
use Twig\Loader\ArrayLoader;
use Twig\Loader\LoaderInterface;
use Twig\Node\Expression\ConstantExpression;
@@ -108,7 +109,7 @@ class FilterTest extends NodeTestCase
public function testCompileWithWrongNamedArgumentName()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown argument "foobar" for filter "date(format, timezone)" at line 1.');
$date = new ConstantExpression(0, 1);
@@ -122,7 +123,7 @@ class FilterTest extends NodeTestCase
public function testCompileWithMissingNamedArgument()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Value for argument "from" is required for filter "replace" at line 1.');
$value = new ConstantExpression(0, 1);
+4 -7
View File
@@ -13,6 +13,7 @@ namespace Twig\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Error\SyntaxError;
use Twig\Loader\LoaderInterface;
use Twig\Node\Node;
use Twig\Node\SetNode;
@@ -25,13 +26,9 @@ use Twig\TokenStream;
class ParserTest extends TestCase
{
/**
* @expectedException \Twig\Error\SyntaxError
* @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1?
*/
public function testUnknownTag()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "foo" tag. Did you mean "for" at line 1?');
$stream = new TokenStream([
@@ -46,7 +43,7 @@ class ParserTest extends TestCase
public function testUnknownTagWithoutSuggestions()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unknown "foobar" tag at line 1.');
$stream = new TokenStream([
@@ -94,7 +91,7 @@ class ParserTest extends TestCase
*/
public function testFilterBodyNodesThrowsException($input)
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$parser = $this->getParser();
+11 -14
View File
@@ -25,7 +25,7 @@ class TemplateTest extends TestCase
{
public function testDisplayBlocksAcceptTemplateOnlyAsBlocks()
{
$this->expectException('\LogicException');
$this->expectException(\LogicException::class);
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$template = new TemplateForTest($twig);
@@ -121,12 +121,11 @@ class TemplateTest extends TestCase
];
}
/**
* @expectedException \Twig\Error\RuntimeError
* @expectedExceptionMessage Block "unknown" on template "index.twig" does not exist in "index.twig".
*/
public function testRenderBlockWithUndefinedBlock()
{
$this->expectException(RuntimeError::class);
$this->expectExceptionMessage('Block "unknown" on template "index.twig" does not exist in "index.twig".');
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$template = new TemplateForTest($twig, 'index.twig');
try {
@@ -138,23 +137,21 @@ class TemplateTest extends TestCase
}
}
/**
* @expectedException \Twig\Error\RuntimeError
* @expectedExceptionMessage Block "unknown" on template "index.twig" does not exist in "index.twig".
*/
public function testDisplayBlockWithUndefinedBlock()
{
$this->expectException(RuntimeError::class);
$this->expectExceptionMessage('Block "unknown" on template "index.twig" does not exist in "index.twig".');
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$template = new TemplateForTest($twig, 'index.twig');
$template->displayBlock('unknown', []);
}
/**
* @expectedException \Twig\Error\RuntimeError
* @expectedExceptionMessage Block "foo" should not call parent() in "index.twig" as the block does not exist in the parent template "parent.twig"
*/
public function testDisplayBlockWithUndefinedParentBlock()
{
$this->expectException(RuntimeError::class);
$this->expectExceptionMessage('Block "foo" should not call parent() in "index.twig" as the block does not exist in the parent template "parent.twig"');
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$template = new TemplateForTest($twig, 'parent.twig');
$template->displayBlock('foo', [], ['foo' => [new TemplateForTest($twig, 'index.twig'), 'block_foo']], false);
@@ -386,7 +383,7 @@ class TemplateTest extends TestCase
public function testGetIsMethods()
{
$this->expectException('\Twig\Error\RuntimeError');
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
$getIsObject = new TemplateGetIsMethods();
$template = new TemplateForTest($twig, 'index.twig');
+3 -2
View File
@@ -12,6 +12,7 @@ namespace Twig\Tests;
*/
use PHPUnit\Framework\TestCase;
use Twig\Error\SyntaxError;
use Twig\Token;
use Twig\TokenStream;
@@ -47,7 +48,7 @@ class TokenStreamTest extends TestCase
public function testEndOfTemplateNext()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unexpected end of template');
$stream = new TokenStream([
@@ -60,7 +61,7 @@ class TokenStreamTest extends TestCase
public function testEndOfTemplateLook()
{
$this->expectException('\Twig\Error\SyntaxError');
$this->expectException(SyntaxError::class);
$this->expectExceptionMessage('Unexpected end of template');
$stream = new TokenStream([