diff --git a/.gitattributes b/.gitattributes
index aa7854a..da20d18 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3,4 +3,5 @@
/.gitignore export-ignore
/examples/ export-ignore
/phpunit.xml.dist export-ignore
+/phpunit.xml.legacy export-ignore
/tests/ export-ignore
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3ef66c5..b460653 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,3 +28,6 @@ jobs:
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text
+ if: ${{ matrix.php >= 7.3 }}
+ - run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
+ if: ${{ matrix.php < 7.3 }}
diff --git a/composer.json b/composer.json
index d47888c..9380f95 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
"react/stream": "^1.0 || ^0.7 || ^0.6"
},
"require-dev": {
- "phpunit/phpunit": "^7.0 || ^6.0",
+ "phpunit/phpunit": "^9.3 || ^6.5",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3"
},
"suggest": {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index a30c9fd..e556ea8 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..9f69ab5
--- /dev/null
+++ b/phpunit.xml.legacy
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ ./tests/
+
+
+
+
+ ./src/
+
+
+
diff --git a/tests/CompressorTest.php b/tests/CompressorTest.php
index 246eada..e33fefd 100644
--- a/tests/CompressorTest.php
+++ b/tests/CompressorTest.php
@@ -6,11 +6,9 @@
class CompressorTest extends TestCase
{
- /**
- * @expectedException InvalidArgumentException
- */
public function testCtorThrowsForInvalidEncoding()
{
+ $this->expectException('InvalidArgumentException');
new Compressor(0);
}
}
diff --git a/tests/DecompressorTest.php b/tests/DecompressorTest.php
index f075127..dd3a2ab 100644
--- a/tests/DecompressorTest.php
+++ b/tests/DecompressorTest.php
@@ -6,11 +6,9 @@
class DecompressorTest extends TestCase
{
- /**
- * @expectedException InvalidArgumentException
- */
public function testCtorThrowsForInvalidEncoding()
{
+ $this->expectException('InvalidArgumentException');
new Decompressor(0);
}
}
diff --git a/tests/DeflateDecompressorTest.php b/tests/DeflateDecompressorTest.php
index 8d47d78..878a57b 100644
--- a/tests/DeflateDecompressorTest.php
+++ b/tests/DeflateDecompressorTest.php
@@ -8,7 +8,10 @@ class DeflateDecompressorTest extends TestCase
{
private $decompressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpDecompressor()
{
$this->decompressor = new Decompressor(ZLIB_ENCODING_RAW);
}
diff --git a/tests/DelateCompressorTest.php b/tests/DelateCompressorTest.php
index 3fa2a70..4466caa 100644
--- a/tests/DelateCompressorTest.php
+++ b/tests/DelateCompressorTest.php
@@ -8,7 +8,10 @@ class DeflateCompressorTest extends TestCase
{
private $compressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpCompressor()
{
$this->compressor = new Compressor(ZLIB_ENCODING_RAW);
}
diff --git a/tests/FunctionalExamplesTest.php b/tests/FunctionalExamplesTest.php
index 490d5c3..341ecbf 100644
--- a/tests/FunctionalExamplesTest.php
+++ b/tests/FunctionalExamplesTest.php
@@ -4,7 +4,10 @@
class FunctionalExamplesTest extends TestCase
{
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpSkipTest()
{
if (DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('Non-blocking console I/O not supported on Windows');
diff --git a/tests/GzipCompressorTest.php b/tests/GzipCompressorTest.php
index 90adc59..9a6c78c 100644
--- a/tests/GzipCompressorTest.php
+++ b/tests/GzipCompressorTest.php
@@ -8,7 +8,10 @@ class GzipCompressorTest extends TestCase
{
private $compressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpCompressor()
{
$this->compressor = new Compressor(ZLIB_ENCODING_GZIP);
}
diff --git a/tests/GzipDecompressorTest.php b/tests/GzipDecompressorTest.php
index 37fad7e..fea42db 100644
--- a/tests/GzipDecompressorTest.php
+++ b/tests/GzipDecompressorTest.php
@@ -8,7 +8,10 @@ class GzipDecompressorTest extends TestCase
{
private $decompressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpDecompressor()
{
$this->decompressor = new Decompressor(ZLIB_ENCODING_GZIP);
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index d9e084b..274f4df 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -39,6 +39,12 @@ protected function expectCallableNever()
protected function createCallableMock()
{
- return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
+ if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
+ // PHPUnit 8.5+
+ return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
+ } else {
+ // legacy PHPUnit 4 - PHPUnit 8.4
+ return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
+ }
}
}
diff --git a/tests/ZlibCompressorTest.php b/tests/ZlibCompressorTest.php
index 6be5933..cf5ed54 100644
--- a/tests/ZlibCompressorTest.php
+++ b/tests/ZlibCompressorTest.php
@@ -8,7 +8,10 @@ class ZlibCompressorTest extends TestCase
{
private $compressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpCompressor()
{
$this->compressor = new Compressor(ZLIB_ENCODING_DEFLATE);
}
diff --git a/tests/ZlibDecompressorTest.php b/tests/ZlibDecompressorTest.php
index e30dcea..598b3aa 100644
--- a/tests/ZlibDecompressorTest.php
+++ b/tests/ZlibDecompressorTest.php
@@ -8,7 +8,10 @@ class ZlibDecompressorTest extends TestCase
{
private $decompressor;
- public function setUp()
+ /**
+ * @before
+ */
+ public function setUpDecompressor()
{
$this->decompressor = new Decompressor(ZLIB_ENCODING_DEFLATE);
}