@@ -124,6 +124,30 @@ public function queryShouldForwardNonTimeoutErrors()
124124 $ retryExecutor ->query ('8.8.8.8 ' , $ query )->then ($ callback , $ errorback );
125125 }
126126
127+ /**
128+ * @test
129+ * @expectedException Exception
130+ * @expectedExceptionMessage query failed
131+ */
132+ public function queryDoesNotHideErrors ()
133+ {
134+ $ executor = $ this ->createExecutorMock ();
135+ $ executor
136+ ->expects ($ this ->once ())
137+ ->method ('query ' )
138+ ->with ('8.8.8.8 ' , $ this ->isInstanceOf ('React\Dns\Query\Query ' ))
139+ ->will ($ this ->returnCallback (function ($ domain , $ query ) {
140+ return Promise \reject (new \Exception ('query failed ' ));
141+ }));
142+
143+ $ retryExecutor = new RetryExecutor ($ executor , 2 );
144+
145+ $ query = new Query ('igor.io ' , Message::TYPE_A , Message::CLASS_IN , 1345656451 );
146+ $ retryExecutor
147+ ->query ('8.8.8.8 ' , $ query )
148+ ->done ();
149+ }
150+
127151 protected function expectCallableOnce ()
128152 {
129153 $ mock = $ this ->createCallableMock ();
@@ -149,7 +173,7 @@ protected function expectPromiseOnce($return = null)
149173 $ mock = $ this ->createPromiseMock ();
150174 $ mock
151175 ->expects ($ this ->once ())
152- ->method ('then ' )
176+ ->method ('done ' )
153177 ->will ($ this ->returnValue ($ return ));
154178
155179 return $ mock ;
@@ -167,7 +191,7 @@ protected function createExecutorMock()
167191
168192 protected function createPromiseMock ()
169193 {
170- return $ this ->getMock ('React\Promise\PromiseInterface ' );
194+ return $ this ->getMock ('React\Promise\ExtendedPromiseInterface ' );
171195 }
172196
173197 protected function createStandardResponse ()
0 commit comments