Skip to content

Commit 95cf988

Browse files
Merge branch '6.2' into 6.3
* 6.2: Avoid call on null [Notifier] Document Firebase options object in readme [ErrorHandler] Fix sending Vary header with SerializerErrorRenderer Fix intl data tests Improve the description of the Intl component [DoctrineBridge] fix issue with missing stopwatch events [HttpClient] Fix canceling MockResponse
2 parents edee61f + 7daf5d2 commit 95cf988

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Response/MockResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function cancel(): void
104104
}
105105

106106
$onProgress = $this->requestOptions['on_progress'] ?? static function () {};
107-
$dlSize = isset($this->headers['content-encoding']) || 'HEAD' === $this->info['http_method'] || \in_array($this->info['http_code'], [204, 304], true) ? 0 : (int) ($this->headers['content-length'][0] ?? 0);
107+
$dlSize = isset($this->headers['content-encoding']) || 'HEAD' === ($this->info['http_method'] ?? null) || \in_array($this->info['http_code'], [204, 304], true) ? 0 : (int) ($this->headers['content-length'][0] ?? 0);
108108
$onProgress($this->offset, $dlSize, $this->info);
109109
}
110110

Tests/MockHttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public function testResetsRequestCount()
534534
$this->assertSame(0, $client->getRequestsCount());
535535
}
536536

537-
public function testCancellingMockResponseExecutesOnProgressWithUpdatedInfo()
537+
public function testCancelingMockResponseExecutesOnProgressWithUpdatedInfo()
538538
{
539539
$client = new MockHttpClient(new MockResponse(['foo', 'bar', 'ccc']));
540540
$canceled = false;

Tests/Response/MockResponseTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ public function testErrorIsTakenIntoAccountInInitialization()
118118
]))->getStatusCode();
119119
}
120120

121+
public function testCancelingAMockResponseNotIssuedByMockHttpClient()
122+
{
123+
$mockResponse = new MockResponse();
124+
$mockResponse->cancel();
125+
126+
$this->assertTrue($mockResponse->getInfo('canceled'));
127+
}
128+
121129
public function testMustBeIssuedByMockHttpClient()
122130
{
123131
$this->expectException(InvalidArgumentException::class);

0 commit comments

Comments
 (0)