diff --git a/composer.json b/composer.json index 48a9073e..9740c9a3 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ }, "require-dev": { "clue/block-react": "^1.1", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^5.0 || ^4.8" }, "autoload": { "psr-4": { diff --git a/tests/DnsConnectorTest.php b/tests/DnsConnectorTest.php index c33850b1..3c94c390 100644 --- a/tests/DnsConnectorTest.php +++ b/tests/DnsConnectorTest.php @@ -13,7 +13,7 @@ class DnsConnectorTest extends TestCase public function setUp() { - $this->tcp = $this->getMock('React\Socket\ConnectorInterface'); + $this->tcp = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $this->resolver = $this->getMockBuilder('React\Dns\Resolver\Resolver')->disableOriginalConstructor()->getMock(); $this->connector = new DnsConnector($this->tcp, $this->resolver); diff --git a/tests/LimitingServerTest.php b/tests/LimitingServerTest.php index 0484a147..2cc9a581 100644 --- a/tests/LimitingServerTest.php +++ b/tests/LimitingServerTest.php @@ -75,7 +75,7 @@ public function testCloseWillBePassedThroughToTcpServer() public function testSocketErrorWillBeForwarded() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $tcp = new TcpServer(0, $loop); @@ -90,7 +90,7 @@ public function testSocketConnectionWillBeForwarded() { $connection = $this->getMockBuilder('React\Socket\ConnectionInterface')->getMock(); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $tcp = new TcpServer(0, $loop); @@ -110,7 +110,7 @@ public function testSocketConnectionWillBeClosedOnceLimitIsReached() $second = $this->getMockBuilder('React\Socket\ConnectionInterface')->getMock(); $second->expects($this->once())->method('close'); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $tcp = new TcpServer(0, $loop); @@ -124,7 +124,7 @@ public function testSocketConnectionWillBeClosedOnceLimitIsReached() public function testPausingServerWillBePausedOnceLimitIsReached() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $loop->expects($this->once())->method('addReadStream'); $loop->expects($this->once())->method('removeReadStream'); diff --git a/tests/SecureConnectorTest.php b/tests/SecureConnectorTest.php index e22c3c75..0b3a7025 100644 --- a/tests/SecureConnectorTest.php +++ b/tests/SecureConnectorTest.php @@ -17,8 +17,8 @@ public function setUp() $this->markTestSkipped('Not supported on your platform (outdated HHVM?)'); } - $this->loop = $this->getMock('React\EventLoop\LoopInterface'); - $this->tcp = $this->getMock('React\Socket\ConnectorInterface'); + $this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); + $this->tcp = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $this->connector = new SecureConnector($this->tcp, $this->loop); } diff --git a/tests/SecureServerTest.php b/tests/SecureServerTest.php index f28a4da7..798e7b4e 100644 --- a/tests/SecureServerTest.php +++ b/tests/SecureServerTest.php @@ -19,7 +19,7 @@ public function testGetAddressWillBePassedThroughToTcpServer() $tcp = $this->getMockBuilder('React\Socket\ServerInterface')->getMock(); $tcp->expects($this->once())->method('getAddress')->willReturn('127.0.0.1:1234'); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $server = new SecureServer($tcp, $loop, array()); @@ -31,7 +31,7 @@ public function testPauseWillBePassedThroughToTcpServer() $tcp = $this->getMockBuilder('React\Socket\ServerInterface')->getMock(); $tcp->expects($this->once())->method('pause'); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $server = new SecureServer($tcp, $loop, array()); @@ -43,7 +43,7 @@ public function testResumeWillBePassedThroughToTcpServer() $tcp = $this->getMockBuilder('React\Socket\ServerInterface')->getMock(); $tcp->expects($this->once())->method('resume'); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $server = new SecureServer($tcp, $loop, array()); @@ -55,7 +55,7 @@ public function testCloseWillBePassedThroughToTcpServer() $tcp = $this->getMockBuilder('React\Socket\ServerInterface')->getMock(); $tcp->expects($this->once())->method('close'); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $server = new SecureServer($tcp, $loop, array()); @@ -64,7 +64,7 @@ public function testCloseWillBePassedThroughToTcpServer() public function testConnectionWillBeEndedWithErrorIfItIsNotAStream() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $tcp = new TcpServer(0, $loop); @@ -80,7 +80,7 @@ public function testConnectionWillBeEndedWithErrorIfItIsNotAStream() public function testSocketErrorWillBeForwarded() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $tcp = new TcpServer(0, $loop); diff --git a/tests/TcpConnectorTest.php b/tests/TcpConnectorTest.php index 9d824ce7..80e80af2 100644 --- a/tests/TcpConnectorTest.php +++ b/tests/TcpConnectorTest.php @@ -141,7 +141,7 @@ public function connectionToIp6TcpServerShouldSucceed() /** @test */ public function connectionToHostnameShouldFailImmediately() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $connector = new TcpConnector($loop); $connector->connect('www.google.com:80')->then( @@ -153,7 +153,7 @@ public function connectionToHostnameShouldFailImmediately() /** @test */ public function connectionToInvalidPortShouldFailImmediately() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $connector = new TcpConnector($loop); $connector->connect('255.255.255.255:12345678')->then( @@ -165,7 +165,7 @@ public function connectionToInvalidPortShouldFailImmediately() /** @test */ public function connectionToInvalidSchemeShouldFailImmediately() { - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $connector = new TcpConnector($loop); $connector->connect('tls://google.com:443')->then( @@ -179,7 +179,7 @@ public function connectionWithInvalidContextShouldFailImmediately() { $this->markTestIncomplete(); - $loop = $this->getMock('React\EventLoop\LoopInterface'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $connector = new TcpConnector($loop, array('bindto' => 'invalid.invalid:123456')); $connector->connect('127.0.0.1:80')->then( diff --git a/tests/TestCase.php b/tests/TestCase.php index 3360e836..81e925d6 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -52,7 +52,7 @@ protected function expectCallableNever() protected function createCallableMock() { - return $this->getMock('React\Tests\Socket\Stub\CallableStub'); + return $this->getMockBuilder('React\Tests\Socket\Stub\CallableStub')->getMock(); } protected function buffer(ReadableStreamInterface $stream, LoopInterface $loop, $timeout) diff --git a/tests/TimeoutConnectorTest.php b/tests/TimeoutConnectorTest.php index 333e8bfd..64787d93 100644 --- a/tests/TimeoutConnectorTest.php +++ b/tests/TimeoutConnectorTest.php @@ -12,7 +12,7 @@ public function testRejectsOnTimeout() { $promise = new Promise\Promise(function () { }); - $connector = $this->getMock('React\Socket\ConnectorInterface'); + $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); $loop = Factory::create(); @@ -31,7 +31,7 @@ public function testRejectsWhenConnectorRejects() { $promise = Promise\reject(new \RuntimeException()); - $connector = $this->getMock('React\Socket\ConnectorInterface'); + $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); $loop = Factory::create(); @@ -50,7 +50,7 @@ public function testResolvesWhenConnectorResolves() { $promise = Promise\resolve(); - $connector = $this->getMock('React\Socket\ConnectorInterface'); + $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); $loop = Factory::create(); @@ -69,7 +69,7 @@ public function testRejectsAndCancelsPendingPromiseOnTimeout() { $promise = new Promise\Promise(function () { }, $this->expectCallableOnce()); - $connector = $this->getMock('React\Socket\ConnectorInterface'); + $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); $loop = Factory::create(); @@ -88,7 +88,7 @@ public function testCancelsPendingPromiseOnCancel() { $promise = new Promise\Promise(function () { }, function () { throw new \Exception(); }); - $connector = $this->getMock('React\Socket\ConnectorInterface'); + $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); $loop = Factory::create(); diff --git a/tests/UnixConnectorTest.php b/tests/UnixConnectorTest.php index 1c86f616..5c988c1a 100644 --- a/tests/UnixConnectorTest.php +++ b/tests/UnixConnectorTest.php @@ -13,7 +13,7 @@ class UnixConnectorTest extends TestCase public function setUp() { - $this->loop = $this->getMock('React\EventLoop\LoopInterface'); + $this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $this->connector = new UnixConnector($this->loop); }