示例#1
0
 public function testApplyThemeCustomization()
 {
     $asset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $file = $this->getMock('Magento\\Theme\\Model\\Theme\\File', [], [], '', false);
     $fileService = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Design\\Theme\\Customization\\FileAssetInterface');
     $file->expects($this->any())->method('getCustomizationService')->will($this->returnValue($fileService));
     $this->assetRepo->expects($this->once())->method('createArbitrary')->will($this->returnValue($asset));
     $this->themeCustomization->expects($this->once())->method('getFiles')->will($this->returnValue([$file]));
     $this->assetsMock->expects($this->once())->method('add')->with($this->anything(), $asset);
     $observer = new \Magento\Framework\Event\Observer();
     $this->themeObserver->applyThemeCustomization($observer);
 }
示例#2
0
 public function testApplyThemeCustomizationException()
 {
     $file = $this->getMock('Magento\\Theme\\Model\\Theme\\File', [], [], '', false);
     $file->expects($this->any())->method('getCustomizationService')->willThrowException(new \InvalidArgumentException());
     $this->themeCustomization->expects($this->once())->method('getFiles')->will($this->returnValue([$file]));
     $this->logger->expects($this->once())->method('critical');
     $observer = new \Magento\Framework\Event\Observer();
     $this->themeObserver->applyThemeCustomization($observer);
 }