[ticket/17496] Fix tests

PHPUnit will automatically create a test double
of required return type to be returned

PHPBB-17496
This commit is contained in:
rxu 2025-04-15 14:57:03 +07:00
parent 118ab73c37
commit d0cb7d6389
No known key found for this signature in database
GPG key ID: 955F0567380E586A

View file

@ -68,8 +68,7 @@ class phpbb_update_get_updates_test extends phpbb_test_case
->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(true);
$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);
@ -84,7 +83,7 @@ class phpbb_update_get_updates_test extends phpbb_test_case
->method('request') ->method('request')
->willReturnCallback(function ($method, $url, $options) ->willReturnCallback(function ($method, $url, $options)
{ {
throw new ClientException('bad client', new \GuzzleHttp\Psr7\Request($method, $url)); throw new ClientException('bad client', new \GuzzleHttp\Psr7\Request($method, $url), new \GuzzleHttp\Psr7\Response());
}); });
$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);