From d6f4a13a7f7cebc3e6512679c80f081a3278505d Mon Sep 17 00:00:00 2001 From: VolCh Date: Sun, 22 Oct 2017 13:30:51 +0300 Subject: [PATCH 1/3] Rewrite tests for PHPUnit 6 --- composer.json | 2 +- .../BashCompletion/Common/CompletionHandlerTestCase.php | 3 ++- .../Console/BashCompletion/CompletionContextTest.php | 3 ++- .../Symfony/Console/BashCompletion/HookFactoryTest.php | 7 +++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 35b75ab..6bfc08b 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/console": "~2.3 || ~3.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.8.36 || ~5.7 || ~6.4" }, "autoload": { "psr-4": { diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php index f4d4a65..af4e743 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php @@ -2,6 +2,7 @@ namespace Stecman\Component\Symfony\Console\BashCompletion\Tests\Common; +use PHPUnit\Framework\TestCase; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler; use Symfony\Component\Console\Application; @@ -9,7 +10,7 @@ /** * Base test case for running CompletionHandlers */ -abstract class CompletionHandlerTestCase extends \PHPUnit_Framework_TestCase +abstract class CompletionHandlerTestCase extends TestCase { /** * @var Application diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionContextTest.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionContextTest.php index 244ca33..9374d13 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionContextTest.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionContextTest.php @@ -2,10 +2,11 @@ namespace Stecman\Component\Symfony\Console\BashCompletion\Tests; +use PHPUnit\Framework\TestCase; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Stecman\Component\Symfony\Console\BashCompletion\EnvironmentCompletionContext; -class CompletionContextTest extends \PHPUnit_Framework_TestCase +class CompletionContextTest extends TestCase { public function testWordBreakSplit() diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/HookFactoryTest.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/HookFactoryTest.php index f697cb5..c253a62 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/HookFactoryTest.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/HookFactoryTest.php @@ -2,9 +2,10 @@ namespace Stecman\Component\Symfony\Console\BashCompletion\Tests; +use PHPUnit\Framework\TestCase; use Stecman\Component\Symfony\Console\BashCompletion\HookFactory; -class HookFactoryTest extends \PHPUnit_Framework_TestCase +class HookFactoryTest extends TestCase { /** * @var HookFactory @@ -91,9 +92,7 @@ protected function assertSyntaxIsValid($code, $syntaxCheckCommand, $context) $status = proc_close($process); - if ($status !== 0) { - $this->fail("Syntax check for $context failed:\n$output"); - } + $this->assertSame(0, $status, "Syntax check for $context failed:\n$output"); } else { throw new \RuntimeException("Failed to start process with command '$syntaxCheckCommand'"); } From 7403983e12f08e11c76248a49a5e78494aa4d1b7 Mon Sep 17 00:00:00 2001 From: Vladimir Chernyshev Date: Sun, 22 Oct 2017 13:45:09 +0300 Subject: [PATCH 2/3] Update PHP versions in CI 5.3 supported by Travis CI now in precise only 7.2 is RC 7.3 is nightly HVVM is 5.6 based and I think that -prefer-lowest is enough nowadays --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d08c961..69dd682 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,19 @@ language: php matrix: include: - php: 5.3 + dist: precise - php: 5.4 - php: 5.5 env: COMPOSER_OPTS="--prefer-lowest" - php: 5.6 - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: nightly - php: hhvm + env: COMPOSER_OPTS="--prefer-lowest" + allow_failures: + - php: nightly before_install: - sudo apt-get update -qq @@ -19,4 +26,4 @@ install: - composer update $COMPOSER_OPTS script: - - phpunit tests + - vendor/bin/phpunit From 210b1caf76640e040741a4ecb938c391e016cbdf Mon Sep 17 00:00:00 2001 From: VolCh Date: Sun, 22 Oct 2017 13:27:57 +0300 Subject: [PATCH 3/3] Allow Symfony 4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6bfc08b..196fb37 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": ">=5.3.2", - "symfony/console": "~2.3 || ~3.0" + "symfony/console": "~2.3 || ~3.0 || ~4.0" }, "require-dev": { "phpunit/phpunit": "~4.8.36 || ~5.7 || ~6.4"