/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Csp/CspUtilTest.php
41 строка
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 CSP util use cases. * * @magentoAppArea frontend */ class CspUtilTest extends AbstractController { /** * Test that CSP helper for templates works. * * @return void * @magentoConfigFixture default_store csp/mode/storefront/report_only 0 * @magentoConfigFixture default_store csp/policies/storefront/scripts/inline 0 */ public function testPhtmlHelper(): void { $this->getRequest()->setMethod('GET'); $this->dispatch('csputil/csp/helper'); $content = $this->getResponse()->getContent(); $this->assertStringContainsString( '<script src="http://my.magento.com/static/script.js"></script>', $content ); $this->assertStringContainsString("\n let myVar = 1;\n</script>", $content); $header = $this->getResponse()->getHeader('Content-Security-Policy'); $this->assertNotEmpty($header); $this->assertStringContainsString('http://my.magento.com', $header->getFieldValue()); } }