From 8ebaf8e64422dd5876e089d81347f10f0bb87e68 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Sat, 22 Apr 2017 15:26:03 +0300 Subject: [PATCH] Support PHPUnit 6 for testing extensions --- lib/Twig/Test/IntegrationTestCase.php | 8 ++++++-- lib/Twig/Test/NodeTestCase.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Twig/Test/IntegrationTestCase.php b/lib/Twig/Test/IntegrationTestCase.php index 2253f7165..df4dbf670 100644 --- a/lib/Twig/Test/IntegrationTestCase.php +++ b/lib/Twig/Test/IntegrationTestCase.php @@ -9,13 +9,16 @@ * file that was distributed with this source code. */ +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Constraint\Exception as ExceptionConstraint; + /** * Integration test helper. * * @author Fabien Potencier * @author Karma Dordrak */ -abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase +abstract class Twig_Test_IntegrationTestCase extends TestCase { /** * @return string @@ -196,7 +199,8 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase if (false !== $exception) { list($class) = explode(':', $exception); - $this->assertThat(null, new PHPUnit_Framework_Constraint_Exception($class)); + $constraintClass = class_exists(ExceptionConstraint::class) ? ExceptionConstraint::class : \PHPUnit_Framework_Constraint_Exception::class; + $this->assertThat(null, new $constraintClass($class)); } $expected = trim($match[3], "\n "); diff --git a/lib/Twig/Test/NodeTestCase.php b/lib/Twig/Test/NodeTestCase.php index a6b550cf8..64c885b51 100644 --- a/lib/Twig/Test/NodeTestCase.php +++ b/lib/Twig/Test/NodeTestCase.php @@ -1,5 +1,7 @@