From 6ed2b163b28c3f8e9b944aab0358174382784b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 22 Sep 2017 16:29:31 +0200 Subject: [PATCH] Update Socket dependency to support hosts file on all platforms --- composer.json | 2 +- src/Factory.php | 4 ---- tests/FactoryTest.php | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 497cdf2..ac6df8e 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", "react/promise": "^2.0 || ^1.1", - "react/socket": "^1.0 || ^0.8 || ^0.7" + "react/socket": "^1.0 || ^0.8.3" }, "autoload": { "psr-4": { "Clue\\React\\Redis\\": "src/" } diff --git a/src/Factory.php b/src/Factory.php index 0bb110e..8508f35 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -107,10 +107,6 @@ private function parseUrl($target) $parts['port'] = 6379; } - if ($parts['host'] === 'localhost') { - $parts['host'] = '127.0.0.1'; - } - if (isset($parts['pass'])) { $parts['auth'] = rawurldecode($parts['pass']); } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index 163e7aa..5924c3a 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -27,9 +27,9 @@ public function testWillConnectWithDefaultPort() $this->factory->createClient('redis.example.com'); } - public function testWillConnectToLocalIpWhenTargetIsLocalhost() + public function testWillConnectToLocalhost() { - $this->connector->expects($this->once())->method('connect')->with('127.0.0.1:1337')->willReturn(Promise\reject(new \RuntimeException())); + $this->connector->expects($this->once())->method('connect')->with('localhost:1337')->willReturn(Promise\reject(new \RuntimeException())); $this->factory->createClient('localhost:1337'); }