From 41caacee6ef294197f18aca8274d5907be424c72 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Jun 2020 12:38:44 +0200 Subject: [PATCH 1/4] Run tests on PHPUnit 9 --- composer.json | 2 +- tests/ControlCodeParserTest.php | 5 ++++- tests/bootstrap.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 63a9c6d..b4a4383 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "react/stream": "^1.0 || ^0.7" }, "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8", + "phpunit/phpunit": "^9.0 || ^5.0 || ^4.8", "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3" } } diff --git a/tests/ControlCodeParserTest.php b/tests/ControlCodeParserTest.php index 1c6a3e0..39c22af 100644 --- a/tests/ControlCodeParserTest.php +++ b/tests/ControlCodeParserTest.php @@ -8,7 +8,10 @@ class ControlCodeParserTest extends TestCase private $input; private $parser; - public function setUp() + /** + * @before + */ + public function setUpParser() { $this->input = new ThroughStream(); $this->parser = new ControlCodeParser($this->input); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 91ad7d3..50a14ab 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,7 +4,7 @@ error_reporting(-1); -class TestCase extends PHPUnit_Framework_TestCase +class TestCase extends PHPUnit\Framework\TestCase { protected function expectCallableNever() { From a4f726451324db6dec1dbc5ec4ece493bc4d1f77 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Jun 2020 12:10:20 +0200 Subject: [PATCH 2/4] Run tests on PHP 7.4 and simplify test matrix --- .travis.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ad1916..0a5430e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,23 @@ language: php -php: -# - 5.3 # requires old distro, see below - - 5.4 - - 5.5 - - 5.6 - - 7 - - 7.1 - - 7.2 - - hhvm # ignore errors, see below - -# lock distro so future defaults will not break the build +# lock distro so new future defaults will not break the build dist: trusty matrix: include: - php: 5.3 dist: precise + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 + - php: hhvm-3.18 allow_failures: - - php: hhvm + - php: hhvm-3.18 sudo: false From d2a84741b039f67cd2f5cea9057af0e783b2a5e5 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Jun 2020 12:16:16 +0200 Subject: [PATCH 3/4] Add .gitattributes to exclude dev files from exports --- .gitattributes | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0925d33 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/examples/ export-ignore +/phpunit.xml.dist export-ignore +/tests/ export-ignore From 44a9a64e027a3fff1b6545c2f10e301cb48e08be Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Jun 2020 12:21:27 +0200 Subject: [PATCH 4/4] Clean up test suite --- composer.json | 3 +++ phpunit.xml.dist | 6 ++---- tests/ControlCodeParserTest.php | 2 ++ tests/FunctionalControlCodeParserTest.php | 2 ++ tests/{bootstrap.php => TestCase.php} | 16 +++------------- 5 files changed, 12 insertions(+), 17 deletions(-) rename tests/{bootstrap.php => TestCase.php} (82%) diff --git a/composer.json b/composer.json index b4a4383..d728c44 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,9 @@ "autoload": { "psr-4": { "Clue\\React\\Term\\": "src/" } }, + "autoload-dev": { + "psr-4": { "Clue\\Tests\\React\\Term\\": "tests/" } + }, "require": { "php": ">=5.3", "react/stream": "^1.0 || ^0.7" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 55088da..d0bb55e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,8 @@ - + - + ./tests/ diff --git a/tests/ControlCodeParserTest.php b/tests/ControlCodeParserTest.php index 39c22af..c94399e 100644 --- a/tests/ControlCodeParserTest.php +++ b/tests/ControlCodeParserTest.php @@ -1,5 +1,7 @@ getMockBuilder('CallableStub')->getMock(); + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); } } - -class CallableStub -{ - public function __invoke() - { - } -} -