mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 03:57:21 +00:00
PHPUnit 6 compatability
This commit is contained in:
@@ -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
@@ -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
@@ -9,7 +9,7 @@
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
bootstrap="test/bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Twig Test Suite">
|
||||
|
||||
@@ -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
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user