diff --git a/.gitattributes b/.gitattributes index 0925d33..eccc763 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,4 +3,5 @@ /.travis.yml export-ignore /examples/ export-ignore /phpunit.xml.dist export-ignore +/phpunit.xml.legacy export-ignore /tests/ export-ignore diff --git a/.travis.yml b/.travis.yml index 3e74fb1..5623330 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: php # lock distro so new future defaults will not break the build dist: trusty -matrix: +jobs: include: - php: 5.3 dist: precise @@ -20,7 +20,8 @@ matrix: - php: hhvm-3.18 install: - - composer install --no-interaction + - composer install script: - - vendor/bin/phpunit --coverage-text + - if [[ "$TRAVIS_PHP_VERSION" > "7.2" ]]; then vendor/bin/phpunit --coverage-text; fi + - if [[ "$TRAVIS_PHP_VERSION" < "7.3" ]]; then vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy; fi diff --git a/composer.json b/composer.json index 6a0083d..0a65a75 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.36" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" }, "autoload": { "psr-4": { "Clue\\StreamFilter\\": "src/" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0edd97b..826c75a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,19 @@ - + + ./tests/ - - + + ./src/ - - - \ No newline at end of file + + + diff --git a/phpunit.xml.legacy b/phpunit.xml.legacy new file mode 100644 index 0000000..ef0f7c9 --- /dev/null +++ b/phpunit.xml.legacy @@ -0,0 +1,18 @@ + + + + + + + ./tests/ + + + + + ./src/ + + + diff --git a/tests/FilterTest.php b/tests/FilterTest.php index bbf95c0..d7e722e 100644 --- a/tests/FilterTest.php +++ b/tests/FilterTest.php @@ -337,6 +337,8 @@ public function testAppendThrowsShouldTriggerEndButIgnoreExceptionDuringEnd() public function testAppendInvalidStreamIsRuntimeError() { + if (PHP_VERSION >= 8) $this->markTestSkipped('Not supported on PHP 8+ (PHP 8 throws TypeError automatically)'); + $this->setExpectedException('RuntimeException'); if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid stream)'); StreamFilter\append(false, function () { }); @@ -344,6 +346,8 @@ public function testAppendInvalidStreamIsRuntimeError() public function testPrependInvalidStreamIsRuntimeError() { + if (PHP_VERSION >= 8) $this->markTestSkipped('Not supported on PHP 8+ (PHP 8 throws TypeError automatically)'); + $this->setExpectedException('RuntimeException'); if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid stream)'); StreamFilter\prepend(false, function () { }); @@ -351,6 +355,8 @@ public function testPrependInvalidStreamIsRuntimeError() public function testRemoveInvalidFilterIsRuntimeError() { + if (PHP_VERSION >= 8) $this->markTestSkipped('Not supported on PHP 8+ (PHP 8 throws TypeError automatically)'); + $this->setExpectedException('RuntimeException'); if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (does not reject invalid filters)'); StreamFilter\remove(false); @@ -403,5 +409,4 @@ public function assertContainsString($needle, $haystack) $this->assertContains($needle, $haystack); } } - } diff --git a/tests/FunZlibTest.php b/tests/FunZlibTest.php index de48b8f..df8b931 100644 --- a/tests/FunZlibTest.php +++ b/tests/FunZlibTest.php @@ -5,7 +5,7 @@ use Clue\StreamFilter; use PHPUnit\Framework\TestCase; -class BuiltInZlibTest extends TestCase +class FunZlibTest extends TestCase { public function testFunZlibDeflateHelloWorld() { @@ -18,7 +18,7 @@ public function testFunZlibDeflateHelloWorld() public function testFunZlibDeflateEmpty() { - if (PHP_VERSION >= 7) $this->markTestSkipped('Not supported on PHP7 (empty string does not invoke filter)'); + if (PHP_VERSION >= 7) $this->markTestSkipped('Not supported on PHP 7+ (empty string does not invoke filter)'); $deflate = StreamFilter\fun('zlib.deflate');