Skip to content

Commit

Permalink
Support PHPUnit 6 for testing extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
hkdobrev committed May 11, 2017
1 parent ef680be commit 8ebaf8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/Twig/Test/IntegrationTestCase.php
Expand Up @@ -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 <fabien@symfony.com>
* @author Karma Dordrak <drak@zikula.org>
*/
abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
abstract class Twig_Test_IntegrationTestCase extends TestCase
{
/**
* @return string
Expand Down Expand Up @@ -196,7 +199,8 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e

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 ");
Expand Down
4 changes: 3 additions & 1 deletion lib/Twig/Test/NodeTestCase.php
@@ -1,5 +1,7 @@
<?php

use PHPUnit\Framework\TestCase;

/*
* This file is part of Twig.
*
Expand All @@ -8,7 +10,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
abstract class Twig_Test_NodeTestCase extends TestCase
{
abstract public function getTests();

Expand Down

0 comments on commit 8ebaf8e

Please sign in to comment.