Skip to content

Commit b12445a

Browse files
committed
Run tests on PHPUnit 9
1 parent 21fad2a commit b12445a

11 files changed

+38
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react/stream": "^1.0 || ^0.7 || ^0.6"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^7.0 || ^6.0",
19+
"phpunit/phpunit": "^9.3 || ^6.5",
2020
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3"
2121
},
2222
"suggest": {

tests/CompressorTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
class CompressorTest extends TestCase
88
{
9-
/**
10-
* @expectedException InvalidArgumentException
11-
*/
129
public function testCtorThrowsForInvalidEncoding()
1310
{
11+
$this->expectException('InvalidArgumentException');
1412
new Compressor(0);
1513
}
1614
}

tests/DecompressorTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
class DecompressorTest extends TestCase
88
{
9-
/**
10-
* @expectedException InvalidArgumentException
11-
*/
129
public function testCtorThrowsForInvalidEncoding()
1310
{
11+
$this->expectException('InvalidArgumentException');
1412
new Decompressor(0);
1513
}
1614
}

tests/DeflateDecompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class DeflateDecompressorTest extends TestCase
88
{
99
private $decompressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpDecompressor()
1215
{
1316
$this->decompressor = new Decompressor(ZLIB_ENCODING_RAW);
1417
}

tests/DelateCompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class DeflateCompressorTest extends TestCase
88
{
99
private $compressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpCompressor()
1215
{
1316
$this->compressor = new Compressor(ZLIB_ENCODING_RAW);
1417
}

tests/FunctionalExamplesTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
class FunctionalExamplesTest extends TestCase
66
{
7-
public function setUp()
7+
/**
8+
* @before
9+
*/
10+
public function setUpSkipTest()
811
{
912
if (DIRECTORY_SEPARATOR === '\\') {
1013
$this->markTestSkipped('Non-blocking console I/O not supported on Windows');

tests/GzipCompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class GzipCompressorTest extends TestCase
88
{
99
private $compressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpCompressor()
1215
{
1316
$this->compressor = new Compressor(ZLIB_ENCODING_GZIP);
1417
}

tests/GzipDecompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class GzipDecompressorTest extends TestCase
88
{
99
private $decompressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpDecompressor()
1215
{
1316
$this->decompressor = new Decompressor(ZLIB_ENCODING_GZIP);
1417
}

tests/TestCase.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ protected function expectCallableNever()
3939

4040
protected function createCallableMock()
4141
{
42-
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
42+
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
43+
// PHPUnit 8.5+
44+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
45+
} else {
46+
// legacy PHPUnit 4 - PHPUnit 8.4
47+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
48+
}
4349
}
4450
}

tests/ZlibCompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class ZlibCompressorTest extends TestCase
88
{
99
private $compressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpCompressor()
1215
{
1316
$this->compressor = new Compressor(ZLIB_ENCODING_DEFLATE);
1417
}

tests/ZlibDecompressorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class ZlibDecompressorTest extends TestCase
88
{
99
private $decompressor;
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpDecompressor()
1215
{
1316
$this->decompressor = new Decompressor(ZLIB_ENCODING_DEFLATE);
1417
}

0 commit comments

Comments
 (0)