[ticket/17496] Correctly restore willReturn()

PHPBB-17496
This commit is contained in:
rxu 2025-04-15 19:42:03 +07:00
parent 0f94e1cb13
commit a5113d7cd3
No known key found for this signature in database
GPG key ID: 955F0567380E586A

View file

@ -13,6 +13,7 @@
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Psr7\Response;
use phpbb\filesystem\exception\filesystem_exception; use phpbb\filesystem\exception\filesystem_exception;
use phpbb\filesystem\filesystem_interface; use phpbb\filesystem\filesystem_interface;
use phpbb\update\get_updates; use phpbb\update\get_updates;
@ -63,12 +64,14 @@ class phpbb_update_get_updates_test extends phpbb_test_case
public function test_download_success() public function test_download_success()
{ {
$response_mock = $this->createMock(Response::class);
$this->http_client->expects($this->once()) $this->http_client->expects($this->once())
->method('request') ->method('request')
->with('GET', 'http://example.com/update.zip', [ ->with('GET', 'http://example.com/update.zip', [
'sink' => '/path/to/storage', 'sink' => '/path/to/storage',
'allow_redirects' => false 'allow_redirects' => false
]); ])
->willReturn($response_mock);
$client_reflection = new \ReflectionProperty($this->update, 'http_client'); $client_reflection = new \ReflectionProperty($this->update, 'http_client');
$client_reflection->setValue($this->update, $this->http_client); $client_reflection->setValue($this->update, $this->http_client);