diff --git a/.travis.yml b/.travis.yml index 41b7510b8..19f8fb570 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/composer.json b/composer.json index f53b91b32..1054f3404 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ce7732785..d800c5769 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,7 +9,7 @@ processIsolation="false" stopOnFailure="false" syntaxCheck="false" - bootstrap="vendor/autoload.php" + bootstrap="test/bootstrap.php" > diff --git a/test/Twig/Tests/CustomExtensionTest.php b/test/Twig/Tests/CustomExtensionTest.php index 9c298f4e7..c706df264 100644 --- a/test/Twig/Tests/CustomExtensionTest.php +++ b/test/Twig/Tests/CustomExtensionTest.php @@ -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); diff --git a/test/bootstrap.php b/test/bootstrap.php index aecb976f7..d167b67de 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -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'); + } +}