Skip to content

Commit d8df50f

Browse files
OskarStarknicolas-grekas
authored andcommitted
Use createMock() and use import instead of FQCN
1 parent 0bafd6b commit d8df50f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Tests/MockHttpClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface
137137
break;
138138

139139
case 'testDnsError':
140-
$mock = $this->getMockBuilder(ResponseInterface::class)->getMock();
140+
$mock = $this->createMock(ResponseInterface::class);
141141
$mock->expects($this->any())
142142
->method('getStatusCode')
143143
->willThrowException(new TransportException('DSN error'));
@@ -160,7 +160,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface
160160
break;
161161

162162
case 'testTimeoutOnAccess':
163-
$mock = $this->getMockBuilder(ResponseInterface::class)->getMock();
163+
$mock = $this->createMock(ResponseInterface::class);
164164
$mock->expects($this->any())
165165
->method('getHeaders')
166166
->willThrowException(new TransportException('Timeout'));
@@ -227,7 +227,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface
227227
break;
228228

229229
case 'testMaxDuration':
230-
$mock = $this->getMockBuilder(ResponseInterface::class)->getMock();
230+
$mock = $this->createMock(ResponseInterface::class);
231231
$mock->expects($this->any())
232232
->method('getContent')
233233
->willReturnCallback(static function (): void {

Tests/TraceableHttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TraceableHttpClientTest extends TestCase
2121
{
2222
public function testItTracesRequest()
2323
{
24-
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
24+
$httpClient = $this->createMock(HttpClientInterface::class);
2525
$httpClient
2626
->expects($this->once())
2727
->method('request')

0 commit comments

Comments
 (0)