From 8837f4b115aeed5f50d2eee9ed6539ddba3d948a Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Fri, 14 Feb 2020 09:08:50 +0100 Subject: [PATCH] Set PhpUnit version for older php --- .travis.yml | 23 +++++---- composer.json | 2 +- tests/BaseTestCase.php | 60 ++++++++++++++++++++++++ tests/Functional/FunctionalTestCase.php | 4 +- tests/Unit/FFMpegServiceProviderTest.php | 3 +- tests/Unit/TestCase.php | 7 +-- 6 files changed, 76 insertions(+), 23 deletions(-) create mode 100644 tests/BaseTestCase.php diff --git a/.travis.yml b/.travis.yml index 3b7b963..cf52955 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,20 +12,19 @@ cache: - $HOME/.composer/cache - $HOME/.cache -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - matrix: include: - php: 5.4 - env: COMPOSER_FLAGS="--prefer-lowest" + env: + - COMPOSER_FLAGS="--prefer-lowest" + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 before_install: - sudo add-apt-repository ppa:mc3man/trusty-media -y @@ -38,4 +37,4 @@ install: - composer update --prefer-dist $COMPOSER_FLAGS script: - - vendor/bin/simple-phpunit --verbose + - vendor/bin/phpunit --verbose diff --git a/composer.json b/composer.json index d574bf6..ba61f03 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "require-dev": { "sami/sami": "~1.0", "silex/silex": "~1.0", - "symfony/phpunit-bridge": "^4.2.12 || ^5.0.4" + "phpunit/phpunit": "^4.8.36 || ^5.0 || ^6.0 || ^7.0" }, "autoload": { "psr-0": { diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php new file mode 100644 index 0000000..0af9d1b --- /dev/null +++ b/tests/BaseTestCase.php @@ -0,0 +1,60 @@ +assertTrue(is_scalar($value), $message); + } + + /** + * Can be removed when phpunit 4.8 (<= needed for php 5.5) support is removed. + */ + public function assertIsArray($value, $message = '') + { + $this->assertTrue(is_array($value), $message); + } + + /** + * Can be removed when phpunit 4.8 (<= needed for php 5.5) support is removed. + */ + public function assertIsInt($value, $message = '') + { + $this->assertTrue(is_int($value), $message); + } + + /** + * Can be removed when phpunit 4.8 (<= needed for php 5.5) support is removed. + */ + public function assertIsBool($value, $message = '') + { + $this->assertTrue(is_bool($value), $message); + } + + /** + * Can be removed when phpunit 4.8 (<= needed for php 5.5) support is removed. + */ + public function assertIsString($value, $message = '') + { + $this->assertTrue(is_string($value), $message); + } + + /** + * Can be removed when phpunit 4.8 (<= needed for php 5.5) support is removed. + */ + public function expectException($exception) + { + // PHPUnt BC Layer + if (method_exists(get_parent_class(), 'expectException')) { + parent::expectException($exception); + + return; + } + + $this->setExpectedException($exception); + } +} diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php index a7eac42..15fcc26 100644 --- a/tests/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -3,9 +3,9 @@ namespace Tests\FFMpeg\Functional; use FFMpeg\FFMpeg; -use PHPUnit\Framework\TestCase; +use Tests\FFMpeg\BaseTestCase; -abstract class FunctionalTestCase extends TestCase +abstract class FunctionalTestCase extends BaseTestCase { /** * @return FFMpeg diff --git a/tests/Unit/FFMpegServiceProviderTest.php b/tests/Unit/FFMpegServiceProviderTest.php index d690480..a15e679 100644 --- a/tests/Unit/FFMpegServiceProviderTest.php +++ b/tests/Unit/FFMpegServiceProviderTest.php @@ -4,9 +4,8 @@ namespace Tests\FFMpeg\Unit; use FFMpeg\FFMpegServiceProvider; use Silex\Application; -use PHPUnit\Framework\TestCase as BaseTestCase; -class FFMpegServiceProviderTest extends BaseTestCase +class FFMpegServiceProviderTest extends TestCase { public function testWithConfig() { diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index f7670bf..60bd004 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -2,15 +2,10 @@ namespace Tests\FFMpeg\Unit; -use PHPUnit\Framework\TestCase as BaseTestCase; +use Tests\FFMpeg\BaseTestCase; class TestCase extends BaseTestCase { - public function assertScalar($value) - { - $this->assertTrue(is_scalar($value)); - } - public function getLoggerMock() { return $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();