/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Csp/CspAwareActionTest.php
43 строки
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2019 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Csp; use Magento\TestFramework\TestCase\AbstractController; /** * Test that controllers can modify CSPs for a page. * * @magentoAppArea frontend */ class CspAwareActionTest extends AbstractController { /** * Check that a CSP aware action can modify CSPs after ALL other policies had been gathered. * * @return void * @magentoConfigFixture default_store csp/mode/storefront/report_only 0 * @magentoConfigFixture default_store csp/policies/storefront/script/policy_id script-src * @magentoConfigFixture default_store csp/policies/storefront/script/none 0 * @magentoConfigFixture default_store csp/policies/storefront/script/hosts/example http://controller.magento.com * @magentoConfigFixture default_store csp/policies/storefront/script/self 0 * @magentoConfigFixture default_store csp/policies/storefront/script/inline 0 */ public function testAwareAction(): void { $this->getRequest()->setMethod('GET'); $this->dispatch('csputil/csp/aware'); $header = $this->getResponse()->getHeader('Content-Security-Policy'); $this->assertNotEmpty($header); $this->assertStringContainsString( 'script-src https://controller.magento.com' .' \'self\' \'sha256-H4RRnauTM2X2Xg/z9zkno1crqhsaY3uKKu97uwmnXXE=\'', $header->getFieldValue() ); } }