@@ -592,14 +592,14 @@ public function testSendRemovesDefaultNoncePlaceholdersWhenCSPDisabled(): void
592592
593593 ob_start ();
594594 $ response ->send ();
595- $ actual = ob_get_contents ();
596- ob_end_clean ();
595+ $ actual = ob_get_clean ();
597596
598597 // Nonce placeholders should be removed when CSP is disabled
599- $ this ->assertStringNotContainsString ('{csp-script-nonce} ' , (string ) $ actual );
600- $ this ->assertStringNotContainsString ('{csp-style-nonce} ' , (string ) $ actual );
601- $ this ->assertStringContainsString ('<script >console.log("test")</script> ' , (string ) $ actual );
602- $ this ->assertStringContainsString ('<style >.test{}</style> ' , (string ) $ actual );
598+ $ this ->assertIsString ($ actual );
599+ $ this ->assertStringNotContainsString ('{csp-script-nonce} ' , $ actual );
600+ $ this ->assertStringNotContainsString ('{csp-style-nonce} ' , $ actual );
601+ $ this ->assertStringContainsString ('<script >console.log("test")</script> ' , $ actual );
602+ $ this ->assertStringContainsString ('<style >.test{}</style> ' , $ actual );
603603 }
604604
605605 public function testSendRemovesCustomNoncePlaceholdersWhenCSPDisabled (): void
@@ -625,14 +625,14 @@ public function testSendRemovesCustomNoncePlaceholdersWhenCSPDisabled(): void
625625
626626 ob_start ();
627627 $ response ->send ();
628- $ actual = ob_get_contents ();
629- ob_end_clean ();
628+ $ actual = ob_get_clean ();
630629
631630 // Custom nonce placeholders should be removed when CSP is disabled
632- $ this ->assertStringNotContainsString ('{custom-script-tag} ' , (string ) $ actual );
633- $ this ->assertStringNotContainsString ('{custom-style-tag} ' , (string ) $ actual );
634- $ this ->assertStringContainsString ('<script >test()</script> ' , (string ) $ actual );
635- $ this ->assertStringContainsString ('<style >.x{}</style> ' , (string ) $ actual );
631+ $ this ->assertIsString ($ actual );
632+ $ this ->assertStringNotContainsString ('{custom-script-tag} ' , $ actual );
633+ $ this ->assertStringNotContainsString ('{custom-style-tag} ' , $ actual );
634+ $ this ->assertStringContainsString ('<script >test()</script> ' , $ actual );
635+ $ this ->assertStringContainsString ('<style >.x{}</style> ' , $ actual );
636636 }
637637
638638 public function testSendNoEffectWhenBodyEmptyAndCSPDisabled (): void
@@ -648,10 +648,10 @@ public function testSendNoEffectWhenBodyEmptyAndCSPDisabled(): void
648648
649649 ob_start ();
650650 $ response ->send ();
651- $ actual = ob_get_contents ();
652- ob_end_clean ();
651+ $ actual = ob_get_clean ();
653652
654- $ this ->assertSame ('' , (string ) $ actual );
653+ $ this ->assertIsString ($ actual );
654+ $ this ->assertSame ('' , $ actual );
655655 }
656656
657657 public function testSendNoEffectWithNoPlaceholdersAndCSPDisabled (): void
@@ -667,11 +667,11 @@ public function testSendNoEffectWithNoPlaceholdersAndCSPDisabled(): void
667667
668668 ob_start ();
669669 $ response ->send ();
670- $ actual = ob_get_contents ();
671- ob_end_clean ();
670+ $ actual = ob_get_clean ();
672671
673672 // Body should be unchanged when there are no placeholders and CSP is disabled
674- $ this ->assertSame ($ body , (string ) $ actual );
673+ $ this ->assertIsString ($ actual );
674+ $ this ->assertSame ($ body , $ actual );
675675 }
676676
677677 public function testSendRemovesMultiplePlaceholdersWhenCSPDisabled (): void
@@ -687,15 +687,15 @@ public function testSendRemovesMultiplePlaceholdersWhenCSPDisabled(): void
687687
688688 ob_start ();
689689 $ response ->send ();
690- $ actual = ob_get_contents ();
691- ob_end_clean ();
690+ $ actual = ob_get_clean ();
692691
693692 // All nonce placeholders should be removed when CSP is disabled
694- $ this ->assertStringNotContainsString ('{csp-script-nonce} ' , (string ) $ actual );
695- $ this ->assertStringNotContainsString ('{csp-style-nonce} ' , (string ) $ actual );
696- $ this ->assertStringContainsString ('<script >console.log("test")</script> ' , (string ) $ actual );
697- $ this ->assertStringContainsString ('<script >console.log("test2")</script> ' , (string ) $ actual );
698- $ this ->assertStringContainsString ('<style >.test{}</style> ' , (string ) $ actual );
699- $ this ->assertStringContainsString ('<style >.test2{}</style> ' , (string ) $ actual );
693+ $ this ->assertIsString ($ actual );
694+ $ this ->assertStringNotContainsString ('{csp-script-nonce} ' , $ actual );
695+ $ this ->assertStringNotContainsString ('{csp-style-nonce} ' , $ actual );
696+ $ this ->assertStringContainsString ('<script >console.log("test")</script> ' , $ actual );
697+ $ this ->assertStringContainsString ('<script >console.log("test2")</script> ' , $ actual );
698+ $ this ->assertStringContainsString ('<style >.test{}</style> ' , $ actual );
699+ $ this ->assertStringContainsString ('<style >.test2{}</style> ' , $ actual );
700700 }
701701}
0 commit comments