public function BlockInterestCohortTest::testExistingInterestCohortPolicy in Drupal 10
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Http/BlockInterestCohortTest.php \Drupal\KernelTests\Core\Http\BlockInterestCohortTest::testExistingInterestCohortPolicy()
Tests that an existing interest-cohort policy is not overwritten.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Http/ BlockInterestCohortTest.php, line 32
Class
- BlockInterestCohortTest
- Tests the Permissions-Policy header added by FinishResponseSubscriber.
Namespace
Drupal\KernelTests\Core\HttpCode
public function testExistingInterestCohortPolicy() {
$headers['Permissions-Policy'] = 'interest-cohort=*';
$kernel = \Drupal::service('http_kernel');
$request = Request::create('/');
$response = new Response('', 200, $headers);
$event = new ResponseEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $response);
\Drupal::service('finish_response_subscriber')
->onRespond($event);
$this
->assertSame($headers['Permissions-Policy'], $response->headers
->get('Permissions-Policy'));
}