X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/88c698796b2097301d494a9109631aa2bc96ec48..refs/pull/3032/head:/tests/Settings/CustomHeadContentTest.php diff --git a/tests/Settings/CustomHeadContentTest.php b/tests/Settings/CustomHeadContentTest.php index 0e44e3ed3..94ef4711d 100644 --- a/tests/Settings/CustomHeadContentTest.php +++ b/tests/Settings/CustomHeadContentTest.php @@ -2,11 +2,11 @@ namespace Tests\Settings; +use BookStack\Util\CspService; use Tests\TestCase; class CustomHeadContentTest extends TestCase { - public function test_configured_content_shows_on_pages() { $this->setSettings(['app-custom-head' => '']); @@ -27,4 +27,40 @@ class CustomHeadContentTest extends TestCase $resp = $this->get('/login'); $resp->assertSee('
cat
'); } -} \ No newline at end of file + + public function test_nonce_application_handles_edge_cases() + { + $mockCSP = $this->mock(CspService::class); + $mockCSP->shouldReceive('getNonce')->andReturn('abc123'); + + $content = trim(' + + + + + + + '); + + $expectedOutput = trim(' + + + + + + + '); + + $this->setSettings(['app-custom-head' => $content]); + $resp = $this->get('/login'); + $resp->assertSee($expectedOutput); + } +}