Update test suite to use new reactphp/async package instead of clue/reactphp-block by clue · Pull Request #296 · reactphp/socket · GitHub
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
3 changes: 1 addition & 2 deletions tests/FdServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace React\Tests\Socket;

use Clue\React\Block;
use React\Promise\Promise;
use React\Socket\ConnectionInterface;
use React\Socket\FdServer;
Expand Down Expand Up @@ -322,7 +321,7 @@ public function testServerEmitsConnectionEventForNewConnection()
$server->on('connection', $resolve);
});

$connection = Block\await($promise, null, 1.0);
$connection = \React\Async\await(\React\Promise\Timer\timeout($promise, 1.0));

/**
* @var ConnectionInterface $connection
Expand Down
1 change: 0 additions & 1 deletion tests/FixedUriConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace React\Tests\Socket;

use React\Socket\FixedUriConnector;
use React\Tests\Socket\TestCase;

class FixedUriConnectorTest extends TestCase
{
Expand Down
17 changes: 8 additions & 9 deletions tests/FunctionalConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace React\Tests\Socket;

use Clue\React\Block;
use React\EventLoop\Loop;
use React\Promise\Deferred;
use React\Socket\ConnectionInterface;
Expand All @@ -24,7 +23,7 @@ public function connectionToTcpServerShouldSucceedWithLocalhost()

$connector = new Connector(array());

$connection = Block\await($connector->connect('localhost:9998'), null, self::TIMEOUT);
$connection = \React\Async\await(\React\Promise\Timer\timeout($connector->connect('localhost:9998'), self::TIMEOUT));

$server->close();

Expand Down Expand Up @@ -63,11 +62,11 @@ public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueTo
fclose($client);
});

$connection = Block\await($connector->connect('example.com:80'));
$connection = \React\Async\await($connector->connect('example.com:80'));
$connection->close();
$this->assertEquals(1, $received);

$connection = Block\await($connector->connect('example.com:80'));
$connection = \React\Async\await($connector->connect('example.com:80'));
$connection->close();
$this->assertEquals(1, $received);

Expand All @@ -85,7 +84,7 @@ public function connectionToRemoteTCP4n6ServerShouldResultInOurIP()

$connector = new Connector(array('happy_eyeballs' => true));

$ip = Block\await($this->request('dual.tlund.se', $connector), null, self::TIMEOUT);
$ip = \React\Async\await(\React\Promise\Timer\timeout($this->request('dual.tlund.se', $connector), self::TIMEOUT));

$this->assertNotFalse(inet_pton($ip));
}
Expand All @@ -99,7 +98,7 @@ public function connectionToRemoteTCP4ServerShouldResultInOurIP()
$connector = new Connector(array('happy_eyeballs' => true));

try {
$ip = Block\await($this->request('ipv4.tlund.se', $connector), null, self::TIMEOUT);
$ip = \React\Async\await(\React\Promise\Timer\timeout($this->request('ipv4.tlund.se', $connector), self::TIMEOUT));
} catch (\Exception $e) {
$this->checkIpv4();
throw $e;
Expand All @@ -118,7 +117,7 @@ public function connectionToRemoteTCP6ServerShouldResultInOurIP()
$connector = new Connector(array('happy_eyeballs' => true));

try {
$ip = Block\await($this->request('ipv6.tlund.se', $connector), null, self::TIMEOUT);
$ip = \React\Async\await(\React\Promise\Timer\timeout($this->request('ipv6.tlund.se', $connector), self::TIMEOUT));
} catch (\Exception $e) {
$this->checkIpv6();
throw $e;
Expand Down Expand Up @@ -151,11 +150,11 @@ public function testCancelPendingTlsConnectionDuringTlsHandshakeShouldCloseTcpCo
});
});

Block\await($deferred->promise(), null, self::TIMEOUT);
\React\Async\await(\React\Promise\Timer\timeout($deferred->promise(), self::TIMEOUT));
$server->close();

try {
Block\await($promise, null, self::TIMEOUT);
\React\Async\await(\React\Promise\Timer\timeout($promise, self::TIMEOUT));
$this->fail();
} catch (\Exception $e) {
$this->assertInstanceOf('RuntimeException', $e);
Expand Down
54 changes: 26 additions & 28 deletions tests/FunctionalSecureServerTest.php
Loading