diff --git a/src/StaticTargetConnector.php b/src/StaticTargetConnector.php new file mode 100644 index 0000000..b2bc130 --- /dev/null +++ b/src/StaticTargetConnector.php @@ -0,0 +1,28 @@ +connector = $connector; + $this->host = $host; + $this->port = $port; + } + + public function create($unusedHost, $unusedPort) + { + return $this->connector->create($this->host, $this->port); + } +} diff --git a/tests/StaticTargetConnectorTest.php b/tests/StaticTargetConnectorTest.php new file mode 100644 index 0000000..4f24077 --- /dev/null +++ b/tests/StaticTargetConnectorTest.php @@ -0,0 +1,24 @@ +getMock('React\SocketClient\ConnectorInterface'); + $connector->expects($this->once()) + ->method('create') + ->with($this->equalTo('proxy.example.com'), $this->equalTo(8080)) + ->will($this->returnValue(Promise\reject(new \Exception()))); + + $static = new StaticTargetConnector($connector, 'proxy.example.com', 8080); + + $promise = $static->create('reactphp.org', 80); + + $promise->then(null, $this->expectCallableOnce()); + } +}