function UpdateFetcherTest::mockClient
Same name in other branches
- 9 core/modules/update/tests/src/Unit/UpdateFetcherTest.php \Drupal\Tests\update\Unit\UpdateFetcherTest::mockClient()
- 11.x core/modules/update/tests/src/Unit/UpdateFetcherTest.php \Drupal\Tests\update\Unit\UpdateFetcherTest::mockClient()
Mocks the HTTP client.
Parameters
\GuzzleHttp\Psr7\Response ...: Variable number of Response objects that the mocked client should return.
2 calls to UpdateFetcherTest::mockClient()
- UpdateFetcherTest::testUpdateFetcherHttpFallback in core/
modules/ update/ tests/ src/ Unit/ UpdateFetcherTest.php - @covers ::doRequest @covers ::fetchProjectData
- UpdateFetcherTest::testUpdateFetcherNoFallback in core/
modules/ update/ tests/ src/ Unit/ UpdateFetcherTest.php - @covers ::doRequest @covers ::fetchProjectData
File
-
core/
modules/ update/ tests/ src/ Unit/ UpdateFetcherTest.php, line 166
Class
- UpdateFetcherTest
- Tests update functionality unrelated to the database.
Namespace
Drupal\Tests\update\UnitCode
protected function mockClient(Response ...$responses) {
// Create a mock and queue responses.
$mock_handler = new MockHandler($responses);
$handler_stack = HandlerStack::create($mock_handler);
$history = Middleware::history($this->history);
$handler_stack->push($history);
$this->mockHttpClient = new Client([
'handler' => $handler_stack,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.