This repository was archived by the owner on Jan 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 22
33namespace Http \Adapter \Cake \Tests ;
44
5+ use Cake \Http \Client as CakeClient ;
56use Cake \Http \Client \Response ;
67use Cake \Http \ServerRequest ;
78use Http \Adapter \Cake \Client ;
@@ -25,17 +26,20 @@ public function testSendRequest(): void
2526 {
2627 $ serverRequest = new ServerRequest ();
2728
28- $ client = new Client ();
29+ $ cakeClient = $ this ->createClientMock ();
30+ $ cakeClient ->expects ($ this ->once ())->method ('send ' )->willReturn (new Response ());
31+
32+ $ client = new Client ($ cakeClient );
2933 $ response = $ client ->sendRequest ($ serverRequest );
3034
3135 $ this ->assertInstanceOf (Response::class, $ response );
3236 }
3337
3438 /**
35- * @return \Http\Adapter\ Cake\Client|\PHPUnit\Framework\MockObject\MockObject
39+ * @return \Cake\Http \Client|\PHPUnit\Framework\MockObject\MockObject
3640 */
37- protected function createHttpAdapterMock (): Client
41+ protected function createClientMock (): CakeClient
3842 {
39- return $ this ->getMockBuilder (Client ::class)->getMock ();
43+ return $ this ->getMockBuilder (CakeClient ::class)-> onlyMethods ([ ' send ' ] )->getMock ();
4044 }
4145}
You can’t perform that action at this time.
0 commit comments