public function testGetBaseConfig() { $this->context->expects($this->once())->method('getPath')->will($this->returnValue('area/theme/locale')); $this->context->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://base.url/')); $expected = <<<expected require.config({"baseUrl":"http://base.url/area/theme/locale"}); expected; $actual = $this->object->getBaseConfig(); $this->assertSame($expected, $actual); }
public function testGetBaseConfig() { $this->context->expects($this->once())->method('getPath')->will($this->returnValue('area/theme/locale')); $this->context->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://base.url/')); $expected = <<<expected require.config({ "baseUrl": "http://base.url/area/theme/locale", "paths": { "magento": "mage/requirejs/plugin/id-normalizer" }, "waitSeconds": 0 }); expected; $actual = $this->object->getBaseConfig(); $this->assertSame($expected, $actual); }
/** * @expectedException \LogicException * @expectedExceptionMessage Unable to resolve the source file for 'context/Magento_Module/dir/file.css' */ public function testGetSourceFileMissing() { $this->context->expects($this->once())->method('getPath')->will($this->returnValue('context')); $this->source->expects($this->once())->method('getFile')->will($this->returnValue(false)); $this->object->getSourceFile(); }
/** * Get base RequireJs configuration necessary for working with Magento application * * @return string */ public function getBaseConfig() { $config = ['baseUrl' => $this->staticContext->getBaseUrl() . $this->staticContext->getPath()]; $config = json_encode($config, JSON_UNESCAPED_SLASHES); return "require.config({$config});"; }
/** * Get base RequireJs configuration necessary for working with Magento application * * @return string */ public function getBaseConfig() { $config = array('baseUrl' => $this->staticContext->getBaseUrl() . $this->staticContext->getPath(), 'paths' => array('magento' => self::NORMALIZE_PLUGIN_PATH), 'waitSeconds' => 0); $config = json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); return "require.config({$config});\n"; }
/** * Get path to '.min' files resolver relative to config files directory * * @return string */ public function getMinResolverRelativePath() { return $this->staticContext->getConfigPath() . '/' . $this->minification->addMinifiedSign(self::MIN_RESOLVER_FILENAME); }