Skip to content

Commit d13fc08

Browse files
committed
Fixes in tests
1 parent 04eebad commit d13fc08

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/instructor/tests/MockHttp.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@
44

55
use Cognesy\Http\Contracts\HttpClientResponse;
66
use Cognesy\Http\HttpClient;
7+
use Cognesy\Http\PendingHttpResponse;
78
use Mockery;
89

910
class 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);

0 commit comments

Comments
 (0)