public function CircleBuildHookTest::testDeploymentHooks in Build Hooks 8.2
Same name and namespace in other branches
- 3.x modules/build_hooks_circleci/tests/src/Kernel/CircleBuildHookTest.php \Drupal\Tests\build_hooks_circleci\Kernel\CircleBuildHookTest::testDeploymentHooks()
Tests deployment hooks.
File
- modules/
build_hooks_circleci/ tests/ src/ Kernel/ CircleBuildHookTest.php, line 45
Class
- CircleBuildHookTest
- Defines a class for testing circle CI build hooks module.
Namespace
Drupal\Tests\build_hooks_circleci\KernelCode
public function testDeploymentHooks() {
$api_key = $this
->randomMachineName();
$this
->config('build_hooks_circleci.settings')
->set('circleci_api_key', $api_key)
->save();
$project = $this
->randomMachineName();
$branch = $this
->randomMachineName();
$expected_url = 'https://circleci.com/api/v1.1/project/github/' . $project . '/build?circle-token=' . $api_key;
$request = $this
->assertFrontendEnvironmentBuildHook('circleci', TriggerInterface::DEPLOYMENT_STRATEGY_ENTITYSAVE, $expected_url, [
'project' => $project,
'branch' => $branch,
]);
$this
->assertEquals(json_encode([
'branch' => $branch,
]), (string) $request
->getBody());
}