Skip to content

Commit 73e6c86

Browse files
committed
fix: Add missing unit test for script-src-elem.
1 parent d7f145d commit 73e6c86

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/system/HTTP/ContentSecurityPolicyTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,21 @@ public function testScriptSrc(): void
302302
$this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", (string) $result);
303303
}
304304

305+
#[PreserveGlobalState(false)]
306+
#[RunInSeparateProcess]
307+
public function testScriptSrcElem(): void
308+
{
309+
$this->prepare();
310+
$this->csp->addScriptSrcElem('cdn.cloudy.com');
311+
$this->csp->addScriptSrcElem('them.com', true);
312+
$result = $this->work();
313+
314+
$result = $this->getHeaderEmitted('Content-Security-Policy-Report-Only');
315+
$this->assertStringContainsString('script-src-elem them.com;', (string) $result);
316+
$result = $this->getHeaderEmitted('Content-Security-Policy');
317+
$this->assertStringContainsString("script-src-elem 'self' cdn.cloudy.com;", (string) $result);
318+
}
319+
305320
#[PreserveGlobalState(false)]
306321
#[RunInSeparateProcess]
307322
public function testStyleSrc(): void

0 commit comments

Comments
 (0)