@@ -459,11 +459,16 @@ public function testBodyScriptNonce()
459459 $ this ->response ->setBody ($ body );
460460 $ this ->csp ->addScriptSrc ('cdn.cloudy.com ' );
461461
462- $ result = $ this ->work ($ body );
462+ $ result = $ this ->work ($ body );
463+ $ nonceStyle = array_filter (
464+ $ this ->getPrivateProperty ($ this ->csp , 'styleSrc ' ),
465+ static fn ($ value ) => strpos ($ value , 'nonce- ' ) === 0
466+ );
463467
464468 $ this ->assertStringContainsString ('nonce= ' , $ this ->response ->getBody ());
465469 $ result = $ this ->getHeaderEmitted ('Content-Security-Policy ' );
466470 $ this ->assertStringContainsString ('nonce- ' , $ result );
471+ $ this ->assertSame ([], $ nonceStyle );
467472 }
468473
469474 public function testBodyScriptNonceCustomScriptTag ()
@@ -525,11 +530,16 @@ public function testBodyStyleNonce()
525530 $ this ->response ->setBody ($ body );
526531 $ this ->csp ->addStyleSrc ('cdn.cloudy.com ' );
527532
528- $ result = $ this ->work ($ body );
533+ $ result = $ this ->work ($ body );
534+ $ nonceScript = array_filter (
535+ $ this ->getPrivateProperty ($ this ->csp , 'scriptSrc ' ),
536+ static fn ($ value ) => strpos ($ value , 'nonce- ' ) === 0
537+ );
529538
530539 $ this ->assertStringContainsString ('nonce= ' , $ this ->response ->getBody ());
531540 $ result = $ this ->getHeaderEmitted ('Content-Security-Policy ' );
532541 $ this ->assertStringContainsString ('nonce- ' , $ result );
542+ $ this ->assertSame ([], $ nonceScript );
533543 }
534544
535545 public function testBodyStyleNonceCustomStyleTag ()
0 commit comments