mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-24 02:01:30 +02:00
Test CSP Nonce
This commit is contained in:
@@ -8,6 +8,9 @@ use DebugBar\StandardDebugBar;
|
||||
|
||||
class JavascriptRendererTest extends DebugBarTestCase
|
||||
{
|
||||
/** @var JavascriptRenderer */
|
||||
protected $r;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -137,6 +140,13 @@ class JavascriptRendererTest extends DebugBarTestCase
|
||||
$this->assertStringStartsWith("<script type=\"text/javascript\">\nvar foovar = new Foobar();\nfoovar.addDataSet(", $this->r->render());
|
||||
}
|
||||
|
||||
public function testRenderConstructorWithNonce()
|
||||
{
|
||||
$this->r->setInitialization(JavascriptRenderer::INITIALIZE_CONSTRUCTOR);
|
||||
$this->r->setCspNonce('mynonce');
|
||||
$this->assertStringStartsWith("<script type=\"text/javascript\" nonce=\"mynonce\">\nvar phpdebugbar = new PhpDebugBar.DebugBar();", $this->r->render());
|
||||
}
|
||||
|
||||
public function testJQueryNoConflictAutoDisabling()
|
||||
{
|
||||
$this->assertTrue($this->r->isJqueryNoConflictEnabled());
|
||||
|
Reference in New Issue
Block a user