mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-10 09:26:29 +00:00
fixed CS
This commit is contained in:
+3
-2
@@ -5,11 +5,12 @@ return PhpCsFixer\Config::create()
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'php_unit_fqcn_annotation' => false,
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'no_unreachable_default_argument_value' => false,
|
||||
'braces' => ['allow_single_line_closure' => true],
|
||||
'heredoc_to_nowdoc' => false,
|
||||
'dir_constant' => false,
|
||||
'ordered_imports' => true,
|
||||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
||||
])
|
||||
->setRiskyAllowed(true)
|
||||
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__))
|
||||
|
||||
@@ -43,7 +43,7 @@ class Twig_Autoloader
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_file($file = dirname(__FILE__).'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) {
|
||||
if (is_file($file = __DIR__.'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) {
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(__FILE__)).'/FilesystemHelper.php';
|
||||
require_once dirname(__DIR__).'/FilesystemHelper.php';
|
||||
|
||||
class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
@@ -76,7 +76,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException RuntimeException
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Unable to create the cache directory
|
||||
*/
|
||||
public function testWriteFailMkdir()
|
||||
@@ -98,7 +98,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException RuntimeException
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Unable to write in the cache directory
|
||||
*/
|
||||
public function testWriteFailDirWritable()
|
||||
@@ -122,7 +122,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException RuntimeException
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Failed to write cache file
|
||||
*/
|
||||
public function testWriteFailWriteFile()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
||||
require_once __DIR__.'/FilesystemHelper.php';
|
||||
|
||||
class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LogicException
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage You must set a loader first.
|
||||
* @group legacy
|
||||
*/
|
||||
@@ -481,7 +481,7 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
* @expectedException \Twig_Error_Runtime
|
||||
* @expectedExceptionMessage Circular reference detected for Twig template "base.html.twig", path: base.html.twig -> base.html.twig in "base.html.twig" at line 1
|
||||
*/
|
||||
public function testFailLoadTemplateOnCircularReference()
|
||||
@@ -494,7 +494,7 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
* @expectedException \Twig_Error_Runtime
|
||||
* @expectedExceptionMessage Circular reference detected for Twig template "base1.html.twig", path: base1.html.twig -> base2.html.twig -> base1.html.twig in "base1.html.twig" at line 1
|
||||
*/
|
||||
public function testFailLoadTemplateOnComplexCircularReference()
|
||||
|
||||
@@ -85,7 +85,7 @@ EOHTML
|
||||
|
||||
public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader()
|
||||
{
|
||||
$loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors');
|
||||
$loader = new Twig_Loader_Filesystem(__DIR__.'/Fixtures/errors');
|
||||
$twig = new Twig_Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
|
||||
|
||||
$template = $twig->loadTemplate('index.html');
|
||||
@@ -98,13 +98,13 @@ EOHTML
|
||||
$this->assertEquals(3, $e->getTemplateLine());
|
||||
$this->assertEquals('index.html', $e->getSourceContext()->getName());
|
||||
$this->assertEquals(3, $e->getLine());
|
||||
$this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
public function testTwigExceptionGuessWithExceptionAndFilesystemLoader()
|
||||
{
|
||||
$loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors');
|
||||
$loader = new Twig_Loader_Filesystem(__DIR__.'/Fixtures/errors');
|
||||
$twig = new Twig_Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]);
|
||||
|
||||
$template = $twig->loadTemplate('index.html');
|
||||
@@ -117,7 +117,7 @@ EOHTML
|
||||
$this->assertEquals(3, $e->getTemplateLine());
|
||||
$this->assertEquals('index.html', $e->getSourceContext()->getName());
|
||||
$this->assertEquals(3, $e->getLine());
|
||||
$this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @dataProvider getFailingTestsForAssignment
|
||||
*/
|
||||
public function testCanOnlyAssignToNames($template)
|
||||
@@ -54,7 +54,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @dataProvider getFailingTestsForArray
|
||||
*/
|
||||
public function testArraySyntaxError($template)
|
||||
@@ -150,7 +150,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
*/
|
||||
public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
|
||||
{
|
||||
@@ -221,7 +221,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
*/
|
||||
public function testAttributeCallDoesNotSupportNamedArguments()
|
||||
{
|
||||
@@ -232,7 +232,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
*/
|
||||
public function testMacroCallDoesNotSupportNamedArguments()
|
||||
{
|
||||
@@ -243,7 +243,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1.
|
||||
*/
|
||||
public function testMacroDefinitionDoesNotSupportNonNameVariableName()
|
||||
@@ -255,7 +255,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1
|
||||
* @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues
|
||||
*/
|
||||
@@ -304,7 +304,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1?
|
||||
*/
|
||||
public function testUnknownFunction()
|
||||
@@ -316,7 +316,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "foobar" function in "index" at line 1.
|
||||
*/
|
||||
public function testUnknownFunctionWithoutSuggestions()
|
||||
@@ -328,7 +328,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1?
|
||||
*/
|
||||
public function testUnknownFilter()
|
||||
@@ -340,7 +340,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1.
|
||||
*/
|
||||
public function testUnknownFilterWithoutSuggestions()
|
||||
@@ -352,7 +352,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1
|
||||
*/
|
||||
public function testUnknownTest()
|
||||
@@ -364,7 +364,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "foobar" test in "index" at line 1.
|
||||
*/
|
||||
public function testUnknownTestWithoutSuggestions()
|
||||
|
||||
@@ -77,7 +77,7 @@ class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
* @expectedException \Twig_Error_Runtime
|
||||
*/
|
||||
public function testRandomFunctionOfEmptyArrayThrowsException()
|
||||
{
|
||||
@@ -136,7 +136,7 @@ class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
* @expectedException \Twig_Error_Runtime
|
||||
*/
|
||||
public function testUnknownCustomEscaper()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Sandbox_SecurityError
|
||||
* @expectedException \Twig_Sandbox_SecurityError
|
||||
* @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3.
|
||||
*/
|
||||
public function testSandboxWithInheritance()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__).'/FilesystemHelper.php';
|
||||
require_once __DIR__.'/FilesystemHelper.php';
|
||||
|
||||
class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class Twig_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase
|
||||
|
||||
public function getFixturesDir()
|
||||
{
|
||||
return dirname(__FILE__).'/Fixtures/';
|
||||
return __DIR__.'/Fixtures/';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class Twig_Tests_LegacyIntegrationTest extends Twig_Test_IntegrationTestCase
|
||||
|
||||
public function getFixturesDir()
|
||||
{
|
||||
return dirname(__FILE__).'/LegacyFixtures/';
|
||||
return __DIR__.'/LegacyFixtures/';
|
||||
}
|
||||
|
||||
public function getTests($name, $legacyTests = false)
|
||||
|
||||
@@ -238,7 +238,7 @@ class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unclosed """
|
||||
*/
|
||||
public function testStringWithUnterminatedInterpolation()
|
||||
@@ -308,7 +308,7 @@ class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unclosed "variable" in "index" at line 3
|
||||
*/
|
||||
public function testUnterminatedVariable()
|
||||
@@ -327,7 +327,7 @@ bar
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unclosed "block" in "index" at line 3
|
||||
*/
|
||||
public function testUnterminatedBlock()
|
||||
|
||||
@@ -23,7 +23,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetSourceWhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -33,7 +33,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetSourceContextWhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -72,7 +72,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetCacheKeyWhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -96,7 +96,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testIsFreshWhenTemplateDoesNotExist()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testGetSourceContext()
|
||||
{
|
||||
$path = dirname(__FILE__).'/../Fixtures';
|
||||
$path = __DIR__.'/../Fixtures';
|
||||
$loader = new Twig_Loader_Chain([
|
||||
new Twig_Loader_Array(['foo' => 'bar']),
|
||||
new Twig_Loader_Array(['errors/index.html' => 'baz']),
|
||||
@@ -47,7 +47,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetSourceContextWhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -58,7 +58,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetSourceWhenTemplateDoesNotExist()
|
||||
{
|
||||
@@ -79,7 +79,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
* @expectedException \Twig_Error_Loader
|
||||
*/
|
||||
public function testGetCacheKeyWhenTemplateDoesNotExist()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testGetSourceContext()
|
||||
{
|
||||
$path = dirname(__FILE__).'/../Fixtures';
|
||||
$path = __DIR__.'/../Fixtures';
|
||||
$loader = new Twig_Loader_Filesystem([$path]);
|
||||
$this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName());
|
||||
$this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath()));
|
||||
@@ -24,7 +24,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testSecurity($template)
|
||||
{
|
||||
$loader = new Twig_Loader_Filesystem([dirname(__FILE__).'/../Fixtures']);
|
||||
$loader = new Twig_Loader_Filesystem([__DIR__.'/../Fixtures']);
|
||||
|
||||
try {
|
||||
$loader->getCacheKey($template);
|
||||
@@ -97,12 +97,12 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
return [
|
||||
[
|
||||
dirname(__FILE__).'/Fixtures',
|
||||
__DIR__.'/Fixtures',
|
||||
'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html',
|
||||
null,
|
||||
],
|
||||
[
|
||||
dirname(__FILE__).'/Fixtures/../Fixtures',
|
||||
__DIR__.'/Fixtures/../Fixtures',
|
||||
'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html',
|
||||
null,
|
||||
],
|
||||
@@ -141,7 +141,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testFindTemplateExceptionNamespace()
|
||||
{
|
||||
$basePath = dirname(__FILE__).'/Fixtures';
|
||||
$basePath = __DIR__.'/Fixtures';
|
||||
|
||||
$loader = new Twig_Loader_Filesystem([$basePath.'/normal']);
|
||||
$loader->addPath($basePath.'/named', 'named');
|
||||
@@ -156,7 +156,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testFindTemplateWithCache()
|
||||
{
|
||||
$basePath = dirname(__FILE__).'/Fixtures';
|
||||
$basePath = __DIR__.'/Fixtures';
|
||||
|
||||
$loader = new Twig_Loader_Filesystem([$basePath.'/normal']);
|
||||
$loader->addPath($basePath.'/named', 'named');
|
||||
@@ -172,9 +172,9 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
public function testLoadTemplateAndRenderBlockWithCache()
|
||||
{
|
||||
$loader = new Twig_Loader_Filesystem([]);
|
||||
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2');
|
||||
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1');
|
||||
$loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme');
|
||||
$loader->addPath(__DIR__.'/Fixtures/themes/theme2');
|
||||
$loader->addPath(__DIR__.'/Fixtures/themes/theme1');
|
||||
$loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme');
|
||||
|
||||
$twig = new Twig_Environment($loader);
|
||||
|
||||
@@ -203,7 +203,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
public function testArrayInheritance($templateName)
|
||||
{
|
||||
$loader = new Twig_Loader_Filesystem([]);
|
||||
$loader->addPath(dirname(__FILE__).'/Fixtures/inheritance');
|
||||
$loader->addPath(__DIR__.'/Fixtures/inheritance');
|
||||
|
||||
$twig = new Twig_Environment($loader);
|
||||
|
||||
@@ -220,7 +220,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
// phar-sample.phar was created with the following script:
|
||||
// $f = new Phar('phar-test.phar');
|
||||
// $f->addFromString('hello.twig', 'hello from phar');
|
||||
$loader->addPath('phar://'.dirname(__FILE__).'/Fixtures/phar/phar-sample.phar');
|
||||
$loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar');
|
||||
$this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode());
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date".
|
||||
*/
|
||||
public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments()
|
||||
@@ -28,7 +28,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Argument "format" is defined twice for function "date".
|
||||
*/
|
||||
public function testGetArgumentsWhenArgumentIsDefinedTwice()
|
||||
@@ -38,7 +38,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)".
|
||||
*/
|
||||
public function testGetArgumentsWithWrongNamedArgumentName()
|
||||
@@ -48,7 +48,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)".
|
||||
*/
|
||||
public function testGetArgumentsWithWrongNamedArgumentNames()
|
||||
@@ -58,7 +58,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage 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".
|
||||
*/
|
||||
public function testResolveArgumentsWithMissingValueForOptionalArgument()
|
||||
@@ -81,7 +81,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LogicException
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []".
|
||||
*/
|
||||
public function testResolveArgumentsWithMissingParameterForArbitraryArguments()
|
||||
@@ -103,7 +103,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LogicException
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$#
|
||||
*/
|
||||
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction()
|
||||
@@ -113,7 +113,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LogicException
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$#
|
||||
*/
|
||||
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject()
|
||||
|
||||
@@ -102,7 +102,7 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1.
|
||||
*/
|
||||
public function testCompileWithWrongNamedArgumentName()
|
||||
@@ -117,7 +117,7 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Value for argument "from" is required for filter "replace" at line 1.
|
||||
*/
|
||||
public function testCompileWithMissingNamedArgument()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
*/
|
||||
public function testSetMacroThrowsExceptionOnReservedMethods()
|
||||
{
|
||||
@@ -20,7 +20,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1?
|
||||
*/
|
||||
public function testUnknownTag()
|
||||
@@ -36,7 +36,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unknown "foobar" tag at line 1.
|
||||
*/
|
||||
public function testUnknownTagWithoutSuggestions()
|
||||
@@ -81,7 +81,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterBodyNodesDataThrowsException
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
*/
|
||||
public function testFilterBodyNodesThrowsException($input)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException LogicException
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testDisplayBlocksAcceptTemplateOnlyAsBlocks()
|
||||
{
|
||||
@@ -434,7 +434,7 @@ class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
* @expectedException \Twig_Error_Runtime
|
||||
*/
|
||||
public function testGetIsMethods()
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unexpected end of template
|
||||
*/
|
||||
public function testEndOfTemplateNext()
|
||||
@@ -66,7 +66,7 @@ class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
* @expectedException \Twig_Error_Syntax
|
||||
* @expectedExceptionMessage Unexpected end of template
|
||||
*/
|
||||
public function testEndOfTemplateLook()
|
||||
|
||||
Reference in New Issue
Block a user