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()); }
public function testCreateRequireJsAssetDevMode() { $this->config->expects($this->once())->method('getConfigFileRelativePath')->will($this->returnValue('requirejs/file.js')); $this->fileSystem->expects($this->once())->method('getDirectoryWrite')->with(DirectoryList::STATIC_VIEW)->will($this->returnValue($this->dir)); $this->assetRepo->expects($this->once())->method('createArbitrary')->with('requirejs/file.js', '')->will($this->returnValue($this->asset)); $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->createRequireJsConfigAsset()); }
public function testToHtml() { $this->context->expects($this->once())->method('getEventManager')->will($this->returnValue($this->getMockForAbstractClass('\\Magento\\Framework\\Event\\ManagerInterface'))); $this->context->expects($this->once())->method('getScopeConfig')->will($this->returnValue($this->getMockForAbstractClass('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface'))); $this->config->expects($this->once())->method('getBaseConfig')->will($this->returnValue('the config data')); $object = new Config($this->context, $this->config, $this->fileManager, $this->pageConfig); $html = $object->toHtml(); $expectedFormat = <<<expected <script type="text/javascript"> the config data</script> expected; $this->assertStringMatchesFormat($expectedFormat, $html); }
public function testCreateRequireJsMixinsAsset() { $path = 'relative path'; $this->configMock->expects($this->once())->method('getMixinsFileRelativePath')->will($this->returnValue($path)); $this->assetRepoMock->expects($this->once())->method('createArbitrary')->with($path, '')->willReturn($this->asset); $this->assertSame($this->asset, $this->object->createRequireJsMixinsAsset()); }
public function testCreateMinResolverAsset() { $this->configMock->expects($this->any())->method('getMinResolverRelativePath')->willReturn('relative path'); $this->assetRepoMock->expects($this->once())->method('createArbitrary')->with('relative path'); $this->fileSystem->expects($this->once())->method('getDirectoryWrite')->with(DirectoryList::STATIC_VIEW)->will($this->returnValue($this->dir)); $this->object->createMinResolverAsset(); }