22
33namespace Clue \Tests \React \Docker ;
44
5- use Clue \React \Buzz \Browser ;
65use Clue \React \Docker \Client ;
76use Psr \Http \Message \RequestInterface ;
87use Psr \Http \Message \ResponseInterface ;
1312class ClientTest extends TestCase
1413{
1514 private $ loop ;
16- private $ sender ;
1715 private $ browser ;
1816
1917 private $ parser ;
@@ -23,9 +21,7 @@ class ClientTest extends TestCase
2321 public function setUp ()
2422 {
2523 $ this ->loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
26- $ this ->sender = $ this ->getMockBuilder ('Clue\React\Buzz\Io\Sender ' )->disableOriginalConstructor ()->getMock ();
27- $ this ->browser = new Browser ($ this ->loop , $ this ->sender );
28- $ this ->browser = $ this ->browser ->withBase ('http://x/ ' );
24+ $ this ->browser = $ this ->getMockBuilder ('Clue\React\Buzz\Browser ' )->disableOriginalConstructor ()->getMock ();
2925
3026 $ this ->parser = $ this ->getMockBuilder ('Clue\React\Docker\Io\ResponseParser ' )->getMock ();
3127 $ this ->streamingParser = $ this ->getMockBuilder ('Clue\React\Docker\Io\StreamingParser ' )->getMock ();
@@ -562,13 +558,8 @@ private function expectRequestFlow($method, $url, ResponseInterface $response, $
562558
563559 private function expectRequest ($ method , $ url , ResponseInterface $ response )
564560 {
565- $ that = $ this ;
566- $ this ->sender ->expects ($ this ->once ())->method ('send ' )->with ($ this ->callback (function (RequestInterface $ request ) use ($ that , $ method , $ url ) {
567- $ that ->assertEquals (strtoupper ($ method ), $ request ->getMethod ());
568- $ that ->assertEquals ('http://x ' . $ url , (string )$ request ->getUri ());
569-
570- return true ;
571- }))->will ($ this ->returnPromise ($ response ));
561+ $ this ->browser ->expects ($ this ->any ())->method ('withOptions ' )->willReturnSelf ();
562+ $ this ->browser ->expects ($ this ->once ())->method (strtolower ($ method ))->with ($ url )->willReturn (\React \Promise \resolve ($ response ));
572563 }
573564
574565 private function createResponse ($ body = '' )
0 commit comments