mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
moved FQDN in tests to use statemetns
This commit is contained in:
@@ -11,10 +11,11 @@ namespace Twig\Tests\Cache;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Cache\FilesystemCache;
|
||||
use Twig\Tests\FilesystemHelper;
|
||||
|
||||
class FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
class FilesystemTest extends TestCase
|
||||
{
|
||||
private $classname;
|
||||
private $directory;
|
||||
|
||||
@@ -11,11 +11,12 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Compiler;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
|
||||
class CompilerTest extends \PHPUnit\Framework\TestCase
|
||||
class CompilerTest extends TestCase
|
||||
{
|
||||
public function testReprNumericValueWithLocale()
|
||||
{
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Twig\RuntimeLoader\ContainerRuntimeLoader;
|
||||
|
||||
class ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
|
||||
class ContainerRuntimeLoaderTest extends TestCase
|
||||
{
|
||||
public function testLoad()
|
||||
{
|
||||
|
||||
@@ -11,11 +11,12 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\ExtensionInterface;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
|
||||
class CustomExtensionTest extends \PHPUnit\Framework\TestCase
|
||||
class CustomExtensionTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideInvalidExtensions
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Cache\CacheInterface;
|
||||
use Twig\Cache\FilesystemCache;
|
||||
use Twig\Environment;
|
||||
@@ -30,7 +31,7 @@ use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
use Twig\TwigTest;
|
||||
|
||||
class EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
class EnvironmentTest extends TestCase
|
||||
{
|
||||
public function testAutoescapeOption()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Error\Error;
|
||||
use Twig\Error\RuntimeError;
|
||||
@@ -18,7 +19,7 @@ use Twig\Loader\ArrayLoader;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
use Twig\Source;
|
||||
|
||||
class ErrorTest extends \PHPUnit\Framework\TestCase
|
||||
class ErrorTest extends TestCase
|
||||
{
|
||||
public function testErrorWithObjectFilename()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Node\Expression\ArrayExpression;
|
||||
@@ -20,7 +21,7 @@ use Twig\Node\Expression\NameExpression;
|
||||
use Twig\Parser;
|
||||
use Twig\Source;
|
||||
|
||||
class ExpressionParserTest extends \PHPUnit\Framework\TestCase
|
||||
class ExpressionParserTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Twig\Error\SyntaxError
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace Twig\Tests\Extension;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
|
||||
class CoreTest extends \PHPUnit\Framework\TestCase
|
||||
class CoreTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getRandomFunctionTestData
|
||||
|
||||
@@ -11,11 +11,12 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\EscaperExtension;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
|
||||
class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
class Twig_Tests_Extension_EscaperTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* All character encodings supported by htmlspecialchars().
|
||||
@@ -158,7 +159,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testHtmlEscapingConvertsSpecialChars()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
foreach ($this->htmlSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'html'), 'Failed to escape: '.$key);
|
||||
}
|
||||
@@ -166,7 +167,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testHtmlAttributeEscapingConvertsSpecialChars()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
foreach ($this->htmlAttrSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'html_attr'), 'Failed to escape: '.$key);
|
||||
}
|
||||
@@ -174,7 +175,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testJavascriptEscapingConvertsSpecialChars()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
foreach ($this->jsSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'js'), 'Failed to escape: '.$key);
|
||||
}
|
||||
@@ -182,19 +183,19 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testJavascriptEscapingReturnsStringIfZeroLength()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$this->assertEquals('', twig_escape_filter($twig, '', 'js'));
|
||||
}
|
||||
|
||||
public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$this->assertEquals('123', twig_escape_filter($twig, '123', 'js'));
|
||||
}
|
||||
|
||||
public function testCssEscapingConvertsSpecialChars()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
foreach ($this->cssSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'css'), 'Failed to escape: '.$key);
|
||||
}
|
||||
@@ -202,19 +203,19 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testCssEscapingReturnsStringIfZeroLength()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$this->assertEquals('', twig_escape_filter($twig, '', 'css'));
|
||||
}
|
||||
|
||||
public function testCssEscapingReturnsStringIfContainsOnlyDigits()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$this->assertEquals('123', twig_escape_filter($twig, '123', 'css'));
|
||||
}
|
||||
|
||||
public function testUrlEscapingConvertsSpecialChars()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
foreach ($this->urlSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'url'), 'Failed to escape: '.$key);
|
||||
}
|
||||
@@ -271,7 +272,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testJavascriptEscapingEscapesOwaspRecommendedRanges()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$immune = [',', '.', '_']; // Exceptions to escaping ranges
|
||||
for ($chr = 0; $chr < 0xFF; ++$chr) {
|
||||
if ($chr >= 0x30 && $chr <= 0x39
|
||||
@@ -295,7 +296,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$immune = [',', '.', '-', '_']; // Exceptions to escaping ranges
|
||||
for ($chr = 0; $chr < 0xFF; ++$chr) {
|
||||
if ($chr >= 0x30 && $chr <= 0x39
|
||||
@@ -319,7 +320,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testCssEscapingEscapesOwaspRecommendedRanges()
|
||||
{
|
||||
$twig = new \Twig\Environment($this->getMockBuilder(\Twig\Loader\LoaderInterface::class)->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
// CSS has no exceptions to escaping ranges
|
||||
for ($chr = 0; $chr < 0xFF; ++$chr) {
|
||||
if ($chr >= 0x30 && $chr <= 0x39
|
||||
@@ -371,7 +372,7 @@ class Twig_Tests_Extension_EscaperTest extends \PHPUnit\Framework\TestCase
|
||||
public function testObjectEscaping(string $escapedHtml, string $escapedJs, array $safeClasses)
|
||||
{
|
||||
$obj = new Extension_TestClass();
|
||||
$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock());
|
||||
$twig = new Environment($this->getMockBuilder(LoaderInterface::class)->getMock());
|
||||
$twig->getExtension('\Twig\Extension\EscaperExtension')->setSafeClasses($safeClasses);
|
||||
$this->assertSame($escapedHtml, twig_escape_filter($twig, $obj, 'html', null, true));
|
||||
$this->assertSame($escapedJs, twig_escape_filter($twig, $obj, 'js', null, true));
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests\Extension;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\SandboxExtension;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
@@ -22,7 +23,7 @@ use Twig\Sandbox\SecurityNotAllowedPropertyError;
|
||||
use Twig\Sandbox\SecurityNotAllowedTagError;
|
||||
use Twig\Sandbox\SecurityPolicy;
|
||||
|
||||
class SandboxTest extends \PHPUnit\Framework\TestCase
|
||||
class SandboxTest extends TestCase
|
||||
{
|
||||
protected static $params;
|
||||
protected static $templates;
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\RuntimeLoader\FactoryRuntimeLoader;
|
||||
|
||||
class FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
|
||||
class FactoryRuntimeLoaderTest extends TestCase
|
||||
{
|
||||
public function testLoad()
|
||||
{
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\FileExtensionEscapingStrategy;
|
||||
|
||||
class FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\TestCase
|
||||
class FileExtensionEscapingStrategyTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getGuessData
|
||||
|
||||
@@ -11,13 +11,14 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Lexer;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Source;
|
||||
use Twig\Token;
|
||||
|
||||
class LexerTest extends \PHPUnit\Framework\TestCase
|
||||
class LexerTest extends TestCase
|
||||
{
|
||||
public function testNameLabelForTag()
|
||||
{
|
||||
@@ -347,7 +348,7 @@ bar
|
||||
public function testOverridingSyntax()
|
||||
{
|
||||
$template = '[# comment #]{# variable #}/# if true #/true/# endif #/';
|
||||
$lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), [
|
||||
$lexer = new Lexer(new Environment($this->getMockBuilder(LoaderInterface::class)->getMock()), [
|
||||
'tag_comment' => ['[#', '#]'],
|
||||
'tag_block' => ['/#', '#/'],
|
||||
'tag_variable' => ['{#', '#}'],
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace Twig\Tests\Loader;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
|
||||
class ArrayTest extends \PHPUnit\Framework\TestCase
|
||||
class ArrayTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Twig\Error\LoaderError
|
||||
|
||||
@@ -11,12 +11,13 @@ namespace Twig\Tests\Loader;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
use Twig\Loader\ChainLoader;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
|
||||
class ChainTest extends \PHPUnit\Framework\TestCase
|
||||
class ChainTest extends TestCase
|
||||
{
|
||||
public function testGetSourceContext()
|
||||
{
|
||||
|
||||
@@ -11,11 +11,12 @@ namespace Twig\Tests\Loader;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Error\LoaderError;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
class FilesystemTest extends \PHPUnit\Framework\TestCase
|
||||
class FilesystemTest extends TestCase
|
||||
{
|
||||
public function testGetSourceContext()
|
||||
{
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace Twig\Tests\Node\Expression;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Node\Expression\CallExpression;
|
||||
|
||||
class CallTest extends \PHPUnit\Framework\TestCase
|
||||
class CallTest extends TestCase
|
||||
{
|
||||
public function testGetArguments()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests\NodeVisitor;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Node\Expression\BlockReferenceExpression;
|
||||
@@ -19,7 +20,7 @@ use Twig\Node\ForNode;
|
||||
use Twig\Node\Node;
|
||||
use Twig\Source;
|
||||
|
||||
class OptimizerTest extends \PHPUnit\Framework\TestCase
|
||||
class OptimizerTest extends TestCase
|
||||
{
|
||||
public function testRenderBlockOptimizer()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Node\Node;
|
||||
@@ -22,7 +23,7 @@ use Twig\Token;
|
||||
use Twig\TokenParser\AbstractTokenParser;
|
||||
use Twig\TokenStream;
|
||||
|
||||
class ParserTest extends \PHPUnit\Framework\TestCase
|
||||
class ParserTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Twig\Error\SyntaxError
|
||||
|
||||
@@ -13,7 +13,9 @@ namespace Twig\Tests\Profiler\Dumper;
|
||||
|
||||
use Twig\Profiler\Profile;
|
||||
|
||||
abstract class AbstractTest extends \PHPUnit\Framework\TestCase
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class AbstractTest extends TestCase
|
||||
{
|
||||
protected function getProfile()
|
||||
{
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace Twig\Tests\Profiler;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Profiler\Profile;
|
||||
|
||||
class ProfileTest extends \PHPUnit\Framework\TestCase
|
||||
class ProfileTest extends TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Error\RuntimeError;
|
||||
use Twig\Extension\SandboxExtension;
|
||||
@@ -20,7 +21,7 @@ use Twig\Sandbox\SecurityError;
|
||||
use Twig\Sandbox\SecurityPolicy;
|
||||
use Twig\Template;
|
||||
|
||||
class TemplateTest extends \PHPUnit\Framework\TestCase
|
||||
class TemplateTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
|
||||
class TemplateWrapperTest extends \PHPUnit\Framework\TestCase
|
||||
class TemplateWrapperTest extends TestCase
|
||||
{
|
||||
public function testHasGetBlocks()
|
||||
{
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace Twig\Tests;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Token;
|
||||
use Twig\TokenStream;
|
||||
|
||||
class TokenStreamTest extends \PHPUnit\Framework\TestCase
|
||||
class TokenStreamTest extends TestCase
|
||||
{
|
||||
protected static $tokens;
|
||||
|
||||
|
||||
@@ -11,12 +11,13 @@ namespace Twig\Tests\Util;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\TwigFunction;
|
||||
use Twig\Util\DeprecationCollector;
|
||||
|
||||
class DeprecationCollectorTest extends \PHPUnit\Framework\TestCase
|
||||
class DeprecationCollectorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @requires PHP 5.3
|
||||
|
||||
Reference in New Issue
Block a user