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
+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);