1
0
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:
Barry vd. Heuvel
2021-06-22 10:01:30 +02:00
parent 87e627ad1a
commit b12bbde6f5

@@ -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());