@@ -84,7 +84,7 @@ public function testPassByResolverIfGivenIp()
84
84
public function testPassByResolverIfGivenIpv6 ()
85
85
{
86
86
$ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
87
- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject ()));
87
+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
88
88
89
89
$ this ->connector ->connect ('[::1]:80 ' );
90
90
@@ -94,7 +94,7 @@ public function testPassByResolverIfGivenIpv6()
94
94
public function testPassThroughResolverIfGivenHost ()
95
95
{
96
96
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
97
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
97
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
98
98
99
99
$ this ->connector ->connect ('google.com:80 ' );
100
100
@@ -104,7 +104,7 @@ public function testPassThroughResolverIfGivenHost()
104
104
public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6 ()
105
105
{
106
106
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('::1 ' ))));
107
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
107
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
108
108
109
109
$ this ->connector ->connect ('google.com:80 ' );
110
110
@@ -114,7 +114,7 @@ public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6()
114
114
public function testPassByResolverIfGivenCompleteUri ()
115
115
{
116
116
$ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
117
- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
117
+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
118
118
119
119
$ this ->connector ->connect ('scheme://127.0.0.1:80/path?query#fragment ' );
120
120
@@ -124,7 +124,7 @@ public function testPassByResolverIfGivenCompleteUri()
124
124
public function testPassThroughResolverIfGivenCompleteUri ()
125
125
{
126
126
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
127
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
127
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
128
128
129
129
$ this ->connector ->connect ('scheme://google.com:80/path?query#fragment ' );
130
130
@@ -134,7 +134,7 @@ public function testPassThroughResolverIfGivenCompleteUri()
134
134
public function testPassThroughResolverIfGivenExplicitHost ()
135
135
{
136
136
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
137
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject ()));
137
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
138
138
139
139
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.de ' );
140
140
@@ -155,12 +155,12 @@ public function testIpv6ResolvesFirstSoIsTheFirstToConnect(array $ipv6, array $i
155
155
$ this ->returnValue (Promise \resolve ($ ipv6 )),
156
156
$ this ->returnValue ($ deferred ->promise ())
157
157
);
158
- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
158
+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
159
159
160
160
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
161
161
162
162
$ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
163
- $ deferred ->reject (new \RuntimeException ( ));
163
+ $ deferred ->reject (new \Exception ( ' reject ' ));
164
164
});
165
165
166
166
$ this ->loop ->run ();
@@ -180,12 +180,12 @@ public function testIpv6DoesntResolvesWhileIpv4DoesFirstSoIpv4Connects(array $ip
180
180
$ this ->returnValue ($ deferred ->promise ()),
181
181
$ this ->returnValue (Promise \resolve ($ ipv4 ))
182
182
);
183
- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
183
+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
184
184
185
185
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
186
186
187
187
$ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
188
- $ deferred ->reject (new \RuntimeException ( ));
188
+ $ deferred ->reject (new \Exception ( ' reject ' ));
189
189
});
190
190
191
191
$ this ->loop ->run ();
0 commit comments