/** * cover update method when fileContent is empty */ public function testUpdateWhenFileDelete() { $customCss = $this->getMockBuilder('Magento\\Framework\\View\\Design\\Theme\\FileInterface')->disableOriginalConstructor()->setMethods(['delete', 'save', 'getContent', 'getFileInfo', 'getFullPath', 'getFileName', 'setFileName', 'getTheme', 'setTheme', 'getCustomizationService', 'setCustomizationService', 'setData', 'getType', 'prepareFile'])->getMock(); $fileContent = ''; $customFiles = [$customCss]; $fileType = 'png'; $theme = $this->getMockBuilder('Magento\\Framework\\View\\Design\\ThemeInterface')->setMethods(['getArea', 'getThemePath', 'getFullPath', 'getParentTheme', 'getCode', 'isPhysical', 'getInheritedThemes', 'getId', 'getCustomization'])->getMock(); $customization = $this->getMockBuilder('Magento\\Framework\\View\\Design\\Theme\\CustomizationInterface')->getMock(); $customCss->expects($this->once())->method('delete'); $this->file->expects($this->once())->method('getType')->willReturn($fileType); $customization->expects($this->once())->method('getFilesByType')->with($fileType)->willReturn($customFiles); $theme->expects($this->once())->method('getCustomization')->willReturn($customization); /** @var \Magento\Framework\View\Design\ThemeInterface $theme */ $this->assertInstanceOf('Magento\\Framework\\View\\Design\\Theme\\FileInterface', $this->object->update($theme, $fileContent)); }