55
66class ConnectionManagerConcurrentTest extends TestCase
77{
8- public function testEmptyRejects ()
8+ /**
9+ * @expectedException InvalidArgumentException
10+ */
11+ public function testEmptyListsThrows ()
912 {
10- $ connector = new ConnectionManagerConcurrent ();
11-
12- $ promise = $ connector ->create ('google.com ' , 80 );
13-
14- $ this ->assertPromiseReject ($ promise );
13+ new ConnectionManagerConcurrent (array ());
1514 }
1615
1716 public function testWillForwardToInnerConnector ()
@@ -21,8 +20,7 @@ public function testWillForwardToInnerConnector()
2120 $ only = $ this ->getMock ('React\SocketClient\ConnectorInterface ' );
2221 $ only ->expects ($ this ->once ())->method ('create ' )->with ('google.com ' , 80 )->willReturn ($ pending );
2322
24- $ connector = new ConnectionManagerConcurrent ();
25- $ connector ->addConnectionManager ($ only );
23+ $ connector = new ConnectionManagerConcurrent (array ($ only ));
2624
2725 $ promise = $ connector ->create ('google.com ' , 80 );
2826
@@ -39,9 +37,7 @@ public function testWillCancelOtherIfOneResolves()
3937 $ second = $ this ->getMock ('React\SocketClient\ConnectorInterface ' );
4038 $ second ->expects ($ this ->once ())->method ('create ' )->with ('google.com ' , 80 )->willReturn ($ pending );
4139
42- $ connector = new ConnectionManagerConcurrent ();
43- $ connector ->addConnectionManager ($ first );
44- $ connector ->addConnectionManager ($ second );
40+ $ connector = new ConnectionManagerConcurrent (array ($ first , $ second ));
4541
4642 $ promise = $ connector ->create ('google.com ' , 80 );
4743
@@ -59,9 +55,7 @@ public function testWillCloseOtherIfOneResolves()
5955 $ second = $ this ->getMock ('React\SocketClient\ConnectorInterface ' );
6056 $ second ->expects ($ this ->once ())->method ('create ' )->with ('google.com ' , 80 )->willReturn (Promise \resolve ($ slower ));
6157
62- $ connector = new ConnectionManagerConcurrent ();
63- $ connector ->addConnectionManager ($ first );
64- $ connector ->addConnectionManager ($ second );
58+ $ connector = new ConnectionManagerConcurrent (array ($ first , $ second ));
6559
6660 $ promise = $ connector ->create ('google.com ' , 80 );
6761
0 commit comments