Skip to content

Commit 5245b18

Browse files
committed
Update PHPUnit and clean up test suite
1 parent ef81edf commit 5245b18

13 files changed

+28
-20
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
"react/stream": "^1.0 || ^0.7 || ^0.6"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^5.0 || ^4.8",
19+
"phpunit/phpunit": "^7.0 || ^6.0",
2020
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3"
2121
},
2222
"suggest": {
2323
"ext-zlib": "Requires ext-zlib extension"
2424
},
2525
"autoload": {
2626
"psr-4": { "Clue\\React\\Zlib\\": "src/" }
27+
},
28+
"autoload-dev": {
29+
"psr-4": { "Clue\\Tests\\React\\Zlib\\": "tests/" }
2730
}
2831
}

phpunit.xml.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit bootstrap="tests/bootstrap.php"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
94
<testsuites>
105
<testsuite name="zlib React Test Suite">
116
<directory>./tests/</directory>

tests/CompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Compressor;
46

57
class CompressorTest extends TestCase

tests/DecompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Decompressor;
46

57
class DecompressorTest extends TestCase

tests/DeflateDecompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Decompressor;
46

57
class DeflateDecompressorTest extends TestCase

tests/DelateCompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Compressor;
46

57
class DeflateCompressorTest extends TestCase

tests/FunctionalExamplesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
class FunctionalExamplesTest extends TestCase
46
{
57
public function setUp()

tests/GzipCompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Compressor;
46

57
class GzipCompressorTest extends TestCase

tests/GzipDecompressorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Zlib;
4+
35
use Clue\React\Zlib\Decompressor;
46

57
class GzipDecompressorTest extends TestCase

tests/bootstrap.php renamed to tests/TestCase.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
require __DIR__ . '/../vendor/autoload.php';
3+
namespace Clue\Tests\React\Zlib;
44

5-
class TestCase extends PHPUnit_Framework_TestCase
5+
class TestCase extends \PHPUnit\Framework\TestCase
66
{
77
protected function expectCallableOnce()
88
{
@@ -37,18 +37,8 @@ protected function expectCallableNever()
3737
return $mock;
3838
}
3939

40-
/**
41-
* @link https://github.com/reactphp/react/blob/master/tests/React/Tests/Socket/TestCase.php (taken from reactphp/react)
42-
*/
4340
protected function createCallableMock()
4441
{
45-
return $this->getMockBuilder('CallableStub')->getMock();
46-
}
47-
}
48-
49-
class CallableStub
50-
{
51-
public function __invoke()
52-
{
42+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
5343
}
5444
}

0 commit comments

Comments
 (0)