Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"require-dev": {
"clue/block-react": "^1.1",
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "^5.0 || ^4.8"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/DnsConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions tests/LimitingServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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');

Expand Down
4 changes: 2 additions & 2 deletions tests/SecureConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
12 changes: 6 additions & 6 deletions tests/SecureServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -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());

Expand All @@ -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());

Expand All @@ -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());

Expand All @@ -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);

Expand All @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions tests/TcpConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions tests/TimeoutConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/UnixConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down