From 8a929d9343595e971a81f2b598e39445a311631f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 25 Aug 2017 14:08:04 +0200 Subject: [PATCH] Update Socket dependency to support hosts file on all platforms --- composer.json | 2 +- tests/FunctionalIntegrationTest.php | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 53f7025..aa0e86b 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/tests/FunctionalIntegrationTest.php b/tests/FunctionalIntegrationTest.php index 764e427..c59c8a4 100644 --- a/tests/FunctionalIntegrationTest.php +++ b/tests/FunctionalIntegrationTest.php @@ -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(); @@ -26,6 +46,7 @@ public function testSuccessfulResponseEmitsEnd() $loop->run(); } + /** @group internet */ public function testCancelPendingConnectionEmitsClose() { $loop = Factory::create();