File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/instructor/tests Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 44
55use Cognesy \Http \Contracts \HttpClientResponse ;
66use Cognesy \Http \HttpClient ;
7+ use Cognesy \Http \PendingHttpResponse ;
78use Mockery ;
89
910class MockHttp
1011{
1112 static public function get (array $ args ) : HttpClient {
1213 $ mockHttp = Mockery::mock (HttpClient::class);
1314 $ mockResponse = Mockery::mock (HttpClientResponse::class);
15+ $ mockPending = Mockery::mock (PendingHttpResponse::class);
1416
1517 $ list = [];
1618 foreach ($ args as $ arg ) {
1719 $ list [] = self ::makeFunc ($ arg );
1820 }
1921
20- $ mockHttp ->shouldReceive ('withRequest ' )->andReturn ($ mockResponse );
21- $ mockHttp ->shouldReceive ('create ' )->andReturn ($ mockResponse );
22+ $ mockHttp ->shouldReceive ('create ' )->andReturn ($ mockPending );
2223 $ mockHttp ->shouldReceive ('with ' )->andReturn ($ mockResponse );
23- $ mockHttp ->shouldReceive ('withRequest ' )->andReturn ($ mockResponse );
24+ $ mockHttp ->shouldReceive ('withRequest ' )->andReturn ($ mockPending );
2425 $ mockHttp ->shouldReceive ('get ' )->andReturn ($ mockResponse );
2526 $ mockHttp ->shouldReceive ('withDebug ' )->andReturn ($ mockHttp );
2627 $ mockHttp ->shouldReceive ('toDebugArray ' )->andReturn ([]);
2728
29+ $ mockPending ->shouldReceive ('get ' )->andReturn ($ mockResponse );
30+
2831 $ mockResponse ->shouldReceive ('statusCode ' )->andReturn (200 );
2932 $ mockResponse ->shouldReceive ('headers ' )->andReturn ([]);
3033 $ mockResponse ->shouldReceive ('body ' )->andReturnUsing (...$ list );
You can’t perform that action at this time.
0 commit comments