PHPUnit 6 compatability

This commit is contained in:
Christian Flothmann
2017-03-10 16:54:15 +01:00
parent 4b2e9ef2a7
commit 0d791de63d
5 changed files with 18 additions and 6 deletions
-1
View File
@@ -31,7 +31,6 @@ install:
before_script:
- if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi
- if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi
- if [ ${TRAVIS_PHP_VERSION:0:3} == "5.2" ]; then sed -i.bak "s|vendor/autoload.php|test/bootstrap.php|" phpunit.xml.dist; fi
matrix:
fast_finish: true
+1 -1
View File
@@ -30,7 +30,7 @@
"php": ">=5.2.7"
},
"require-dev": {
"symfony/phpunit-bridge": "~3.2",
"symfony/phpunit-bridge": "~3.3@dev",
"symfony/debug": "~2.7",
"psr/container": "^1.0"
},
+1 -1
View File
@@ -9,7 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
bootstrap="test/bootstrap.php"
>
<testsuites>
<testsuite name="Twig Test Suite">
+6 -1
View File
@@ -17,7 +17,12 @@ class CustomExtensionTest extends PHPUnit_Framework_TestCase
*/
public function testGetInvalidOperators(Twig_ExtensionInterface $extension, $expectedExceptionMessage)
{
$this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
if (method_exists($this, 'expectException')) {
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage($expectedExceptionMessage);
} else {
$this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
}
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
$env->addExtension($extension);
+10 -2
View File
@@ -9,5 +9,13 @@
* file that was distributed with this source code.
*/
require_once dirname(__FILE__).'/../lib/Twig/Autoloader.php';
Twig_Autoloader::register(true);
if (PHP_VERSION_ID < 50300) {
require_once dirname(__FILE__).'/../lib/Twig/Autoloader.php';
Twig_Autoloader::register(true);
} else {
require __DIR__.'/../vendor/autoload.php';
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
}
}