/** * Include RequireJs configuration as an asset on the page * * @return \Magento\Framework\View\Asset\LocalInterface */ public function getAsset() { if (!$this->asset) { $this->asset = $this->fileManager->createRequireJsAsset(); } return $this->asset; }
public function testCreateRequireJsAssetDevMode() { $this->appState->expects($this->once())->method('getMode')->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER)); $this->dir->expects($this->never())->method('isExist'); $data = 'requirejs config data'; $this->config->expects($this->once())->method('getConfig')->will($this->returnValue($data)); $this->dir->expects($this->once())->method('writeFile')->with('requirejs/file.js', $data); $this->assertSame($this->asset, $this->object->createRequireJsAsset()); }