mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-25 10:41:55 +02:00
Test CSP Nonce
This commit is contained in:
@@ -8,6 +8,9 @@ use DebugBar\StandardDebugBar;
|
|||||||
|
|
||||||
class JavascriptRendererTest extends DebugBarTestCase
|
class JavascriptRendererTest extends DebugBarTestCase
|
||||||
{
|
{
|
||||||
|
/** @var JavascriptRenderer */
|
||||||
|
protected $r;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
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());
|
$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()
|
public function testJQueryNoConflictAutoDisabling()
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->r->isJqueryNoConflictEnabled());
|
$this->assertTrue($this->r->isJqueryNoConflictEnabled());
|
||||||
|
Reference in New Issue
Block a user