protected function BuildHooksKernelTestBase::mockClient in Build Hooks 8.2
Same name and namespace in other branches
- 3.x tests/src/Kernel/BuildHooksKernelTestBase.php \Drupal\Tests\build_hooks\Kernel\BuildHooksKernelTestBase::mockClient()
Mocks the http-client.
3 calls to BuildHooksKernelTestBase::mockClient()
- BuildHooksKernelTestBase::assertFrontendEnvironmentBuildHook in tests/
src/ Kernel/ BuildHooksKernelTestBase.php - Assert a front-end environment build hook fires.
- CircleBuildHookTest::testDeploymentInfo in modules/
build_hooks_circleci/ tests/ src/ Kernel/ CircleBuildHookTest.php - Tests deployment info.
- DeploymentStorageHandlerTest::setUp in tests/
src/ Kernel/ DeploymentStorageHandlerTest.php
File
- tests/
src/ Kernel/ BuildHooksKernelTestBase.php, line 63
Class
- BuildHooksKernelTestBase
- Defines a base kernel test class for Build Hooks module.
Namespace
Drupal\Tests\build_hooks\KernelCode
protected function mockClient(Response ...$responses) {
if (!isset($this->mockClient)) {
// Create a mock and queue two responses.
$mock = new MockHandler($responses);
$handler_stack = HandlerStack::create($mock);
$history = Middleware::history($this->history);
$handler_stack
->push($history);
$this->mockClient = new Client([
'handler' => $handler_stack,
]);
}
$this->container
->set('http_client', $this->mockClient);
}