This repository was archived by the owner on Jan 8, 2024. It is now read-only.
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Http \Adapter \Cake \Tests ;
4
4
5
+ use Cake \Http \Client as CakeClient ;
5
6
use Cake \Http \Client \Response ;
6
7
use Cake \Http \ServerRequest ;
7
8
use Http \Adapter \Cake \Client ;
@@ -25,17 +26,20 @@ public function testSendRequest(): void
25
26
{
26
27
$ serverRequest = new ServerRequest ();
27
28
28
- $ client = new Client ();
29
+ $ cakeClient = $ this ->createClientMock ();
30
+ $ cakeClient ->expects ($ this ->once ())->method ('send ' )->willReturn (new Response ());
31
+
32
+ $ client = new Client ($ cakeClient );
29
33
$ response = $ client ->sendRequest ($ serverRequest );
30
34
31
35
$ this ->assertInstanceOf (Response::class, $ response );
32
36
}
33
37
34
38
/**
35
- * @return \Http\Adapter\ Cake\Client|\PHPUnit\Framework\MockObject\MockObject
39
+ * @return \Cake\Http \Client|\PHPUnit\Framework\MockObject\MockObject
36
40
*/
37
- protected function createHttpAdapterMock (): Client
41
+ protected function createClientMock (): CakeClient
38
42
{
39
- return $ this ->getMockBuilder (Client ::class)->getMock ();
43
+ return $ this ->getMockBuilder (CakeClient ::class)-> onlyMethods ([ ' send ' ] )->getMock ();
40
44
}
41
45
}
You can’t perform that action at this time.
0 commit comments