/** * Get a populated resource container for testing. * * @return ResourceContainer */ protected function getResourceContainer() { $rc = new ResourceContainer(); $rc->setEncoding('utf-8'); $rc->setGenerator('fake-generator'); return $rc; }
/** * Add scripts to header. * * @return void */ protected function addScripts() { // Load Javascript (same ordering considerations as CSS, above): $headScript = $this->getView()->plugin('headscript'); foreach (array_reverse($this->container->getJs()) as $current) { $parts = $this->parseSetting($current); $headScript()->prependFile(trim($parts[0]), 'text/javascript', isset($parts[1]) ? ['conditional' => trim($parts[1])] : []); } }
/** * Remove ignored js file before they're added to the resources * * @param array|string $js Javascript file (or array of files) to add (possibly * with extra settings from theme config appended to * each filename string). * * @return void */ public function addJs($js) { $js = $this->removeIgnoredFiles($js, $this->ignoredJsFiles); parent::addJs($js); }
/** * Test Generator set/get. * * @return void */ public function testGenerator() { $container = new ResourceContainer(); $container->setGenerator('fake'); $this->assertEquals('fake', $container->getGenerator()); }