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);
    }
Exemple #2
0
    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);
    }
Exemple #3
0
 /**
  * @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();
 }
Exemple #4
0
 /**
  * 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});";
 }
Exemple #5
0
 /**
  * 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";
 }
Exemple #6
0
 /**
  * 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);
 }