Skip to content

Commit

Permalink
Merge pull request #108 from clue-labs/hosts
Browse files Browse the repository at this point in the history
Update Socket dependency to support hosts file on all platforms
  • Loading branch information
WyriHaximus authored Aug 25, 2017
2 parents 1d5364d + 8a929d9 commit 26fddc2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=5.4.0",
"guzzlehttp/psr7": "^1.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/socket": "^1.0 || ^0.8 || ^0.7",
"react/socket": "^1.0 || ^0.8.2",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.2",
"react/promise": "~2.2",
"evenement/evenement": "^3.0 || ^2.0"
Expand Down
23 changes: 22 additions & 1 deletion tests/FunctionalIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@
use React\EventLoop\Factory;
use React\HttpClient\Client;
use React\HttpClient\Response;
use React\Socket\Server;
use React\Socket\ConnectionInterface;

/** @group internet */
class FunctionalIntegrationTest extends TestCase
{
public function testRequestToLocalhostEmitsSingleRemoteConnection()
{
$loop = Factory::create();

$server = new Server(0, $loop);
$server->on('connection', function (ConnectionInterface $conn) use ($server) {
$conn->end("HTTP/1.1 200 OK\r\n\r\nOk");
$server->close();
});
$port = parse_url($server->getAddress(), PHP_URL_PORT);

$client = new Client($loop);
$request = $client->request('GET', 'http://localhost:' . $port);
$request->end();

$loop->run();
}

/** @group internet */
public function testSuccessfulResponseEmitsEnd()
{
$loop = Factory::create();
Expand All @@ -26,6 +46,7 @@ public function testSuccessfulResponseEmitsEnd()
$loop->run();
}

/** @group internet */
public function testCancelPendingConnectionEmitsClose()
{
$loop = Factory::create();
Expand Down

0 comments on commit 26fddc2

Please sign in to comment.