File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,6 +374,21 @@ public function testScriptSrc(): void
374374 $ this ->assertContains ("script-src 'self' cdn.cloudy.com " , $ this ->getCspDirectives ($ header ));
375375 }
376376
377+ #[PreserveGlobalState(false )]
378+ #[RunInSeparateProcess]
379+ public function testScriptSrcElem (): void
380+ {
381+ $ this ->prepare ();
382+ $ this ->csp ->addScriptSrcElem ('cdn.cloudy.com ' );
383+ $ this ->csp ->addScriptSrcElem ('them.com ' , true );
384+ $ result = $ this ->work ();
385+
386+ $ result = $ this ->getHeaderEmitted ('Content-Security-Policy-Report-Only ' );
387+ $ this ->assertStringContainsString ('script-src-elem them.com; ' , (string ) $ result );
388+ $ result = $ this ->getHeaderEmitted ('Content-Security-Policy ' );
389+ $ this ->assertStringContainsString ("script-src-elem 'self' cdn.cloudy.com; " , (string ) $ result );
390+ }
391+
377392 #[PreserveGlobalState(false )]
378393 #[RunInSeparateProcess]
379394 public function testStyleSrc (): void
You can’t perform that action at this time.
0 commit comments