This commit is contained in:
Fabien Potencier
2020-08-23 13:48:32 +02:00
parent 2c7cad3416
commit bde54e11b8
7 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -547,7 +547,7 @@ function twig_round($value, $precision = 0, $method = 'common')
throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.');
}
return $method($value * pow(10, $precision)) / pow(10, $precision);
return $method($value * 10 ** $precision) / 10 ** $precision;
}
/**
+1 -1
View File
@@ -167,7 +167,7 @@ class FilesystemTest extends \PHPUnit\Framework\TestCase
public function testGenerateKey($expected, $input)
{
$cache = new FilesystemCache($input);
$this->assertMatchesRegularExpression($expected, $cache->generateKey('_test_', \get_class($this)));
$this->assertMatchesRegularExpression($expected, $cache->generateKey('_test_', static::class));
}
public function provideDirectories()
+2 -2
View File
@@ -212,14 +212,14 @@ EOHTML
public function testTwigLeakOutputInDebugMode()
{
$output = exec(sprintf('%s %s debug', \PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
$output = exec(sprintf('%s %s debug', PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
$this->assertSame('Hello OOPS', $output);
}
public function testDoesNotTwigLeakOutput()
{
$output = exec(sprintf('%s %s', \PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
$output = exec(sprintf('%s %s', PHP_BINARY, escapeshellarg(__DIR__.'/Fixtures/errors/leak-output.php')));
$this->assertSame('', $output);
}
+1 -2
View File
@@ -46,7 +46,7 @@ class SandboxTest extends \PHPUnit\Framework\TestCase
'1_include' => '{{ include("1_basic1", sandboxed=true) }}',
'1_range_operator' => '{{ (1..2)[0] }}',
'1_syntax_error_wrapper' => '{% sandbox %}{% include "1_syntax_error" %}{% endsandbox %}',
'1_syntax_error' => '{% syntax error }}'
'1_syntax_error' => '{% syntax error }}',
];
}
@@ -335,7 +335,6 @@ EOF
$this->expectException('\Twig\Error\RuntimeError');
$this->expectExceptionMessage('The callable passed to "filter" filter must be a Closure in sandbox mode in "index" at line 1.');
$twig = $this->getEnvironment(true, ['autoescape' => 'html'], ['index' => <<<EOF
{{ ["foo", "bar", ""]|filter("trim")|join(", ") }}
EOF
+1 -1
View File
@@ -20,7 +20,7 @@ class BrokenExtension extends AbstractExtension
public function broken()
{
die('OOPS');
exit('OOPS');
}
}
-1
View File
@@ -75,7 +75,6 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase
* @param bool $isTemplate
* @param string $type
* @param string $templateName
* @param array $subProfiles
*
* @return Profile
*/
+1 -1
View File
@@ -8,7 +8,7 @@ namespace Twig\Tests;
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://framework.zend.com/license/new-bsd New BSD License
*/
class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase
class escapingTest extends \PHPUnit\Framework\TestCase
{
/**
* All character encodings supported by htmlspecialchars().