Skip to content

Commit 49bf790

Browse files
GrahamCampbellm1guelpf
authored andcommitted
Updated http methods client mocking
1 parent fe4508b commit 49bf790

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/Gitlab/Tests/ResultPagerTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use GuzzleHttp\Psr7\Response;
1010
use function GuzzleHttp\Psr7\stream_for;
1111
use Http\Client\Common\HttpMethodsClient;
12+
use Http\Client\Common\HttpMethodsClientInterface;
1213
use PHPUnit\Framework\TestCase;
1314

1415
class ResultPagerTest extends TestCase
@@ -70,10 +71,14 @@ public function testFetchAll()
7071
))
7172
;
7273

73-
$httpClient = $this->getMockBuilder(HttpMethodsClient::class)
74-
->disableOriginalConstructor()
75-
->getMock()
76-
;
74+
if (interface_exists(HttpMethodsClientInterface::class)) {
75+
$httpClient = $this->createMock(HttpMethodsClientInterface::class);
76+
} else {
77+
$httpClient = $this->getMockBuilder(HttpMethodsClient::class)
78+
->disableOriginalConstructor()
79+
->getMock()
80+
;
81+
}
7782

7883
$httpClient->expects($this->exactly(2))
7984
->method('get')

0 commit comments

Comments
 (0)