FIX Set nonce style on unit tests

This commit is contained in:
Steve Boyd 2020-05-13 16:07:31 +12:00
parent e5d0400596
commit b1b61f866e
2 changed files with 6 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class SimpleResourceURLGeneratorTest extends SapphireTest
{ {
/** @var SimpleResourceURLGenerator $generator */ /** @var SimpleResourceURLGenerator $generator */
$generator = Injector::inst()->get(ResourceURLGenerator::class); $generator = Injector::inst()->get(ResourceURLGenerator::class);
$generator->setNonceStyle('mtime');
$mtime = filemtime( $mtime = filemtime(
__DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css' __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/client/style.css'
); );
@ -86,6 +87,7 @@ class SimpleResourceURLGeneratorTest extends SapphireTest
{ {
/** @var SimpleResourceURLGenerator $generator */ /** @var SimpleResourceURLGenerator $generator */
$generator = Injector::inst()->get(ResourceURLGenerator::class); $generator = Injector::inst()->get(ResourceURLGenerator::class);
$generator->setNonceStyle('mtime');
$mtime = filemtime( $mtime = filemtime(
__DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/public/basemodule/css/style.css' __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/public/basemodule/css/style.css'
); );
@ -109,6 +111,7 @@ class SimpleResourceURLGeneratorTest extends SapphireTest
{ {
/** @var SimpleResourceURLGenerator $generator */ /** @var SimpleResourceURLGenerator $generator */
$generator = Injector::inst()->get(ResourceURLGenerator::class); $generator = Injector::inst()->get(ResourceURLGenerator::class);
$generator->setNonceStyle('mtime');
$module = new Module( $module = new Module(
__DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/', __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/vendor/silverstripe/mymodule/',
__DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/' __DIR__ . '/SimpleResourceURLGeneratorTest/_fakewebroot/'

View File

@ -642,6 +642,9 @@ class RequirementsTest extends SapphireTest
$backend = Injector::inst()->create(Requirements_Backend::class); $backend = Injector::inst()->create(Requirements_Backend::class);
$this->setupRequirements($backend); $this->setupRequirements($backend);
$generator = Injector::inst()->get(ResourceURLGenerator::class);
$generator->setNonceStyle('mtime');
$backend->javascript('javascript/RequirementsTest_a.js?test=1&test=2&test=3'); $backend->javascript('javascript/RequirementsTest_a.js?test=1&test=2&test=3');
$backend->css('css/RequirementsTest_a.css?test=1&test=2&test=3'); $backend->css('css/RequirementsTest_a.css?test=1&test=2&test=3');
$html = $backend->includeInHTML(self::$html_template); $html = $backend->includeInHTML(self::$html_template);