public function testSetLayout() { $filePath = 'require_js_fie_path'; $asset = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Asset\\LocalInterface'); $asset->expects($this->atLeastOnce())->method('getFilePath')->willReturn($filePath); $this->fileManager->expects($this->once())->method('createRequireJsAsset')->will($this->returnValue($asset)); $layout = $this->getMock('Magento\\Framework\\View\\LayoutInterface'); $assetCollection = $this->getMockBuilder('Magento\\Framework\\View\\Asset\\GroupedCollection')->disableOriginalConstructor()->getMock(); $assetCollection->expects($this->once())->method('add')->with($filePath, $asset); $this->pageConfig->expects($this->atLeastOnce())->method('getAssetCollection')->willReturn($assetCollection); $object = new Config($this->context, $this->config, $this->fileManager, $this->pageConfig); $object->setLayout($layout); }