8 use \Magento\Theme\Model\Theme\SingleFile;
27 $this->file = $this->getMockBuilder(\
Magento\Framework\View\
Design\
Theme\Customization\FileInterface::class)
36 public function testUpdate()
38 $fileContent =
'file content';
41 $customCss = $this->getMockBuilder(\
Magento\Framework\View\
Design\
Theme\FileInterface::class)
42 ->disableOriginalConstructor()
54 'getCustomizationService',
55 'setCustomizationService',
77 $customization = $this->getMockBuilder(\
Magento\Framework\View\
Design\
Theme\CustomizationInterface::class)
80 $customCss->expects($this->once())
82 ->with(
'content', $fileContent);
83 $customCss->expects($this->once())
86 $customCss->expects($this->once())
88 $this->file->expects($this->once())
90 ->willReturn($customCss);
91 $this->file->expects($this->once())
93 ->willReturn($fileType);
94 $customization->expects($this->once())
95 ->method(
'getFilesByType')
97 ->willReturn($customFiles);
98 $theme->expects($this->once())
99 ->method(
'getCustomization')
100 ->willReturn($customization);
103 $this->assertInstanceOf(
105 $this->object->update(
$theme, $fileContent)
112 public function testUpdateWhenFileDelete()
114 $customCss = $this->getMockBuilder(\
Magento\Framework\View\
Design\
Theme\FileInterface::class)
115 ->disableOriginalConstructor()
127 'getCustomizationService',
128 'setCustomizationService',
136 $customFiles = [$customCss];
148 'getInheritedThemes',
154 $customization = $this->getMockBuilder(\
Magento\Framework\View\
Design\
Theme\CustomizationInterface::class)
157 $customCss->expects($this->once())
159 $this->file->expects($this->once())
161 ->willReturn($fileType);
162 $customization->expects($this->once())
163 ->method(
'getFilesByType')
165 ->willReturn($customFiles);
166 $theme->expects($this->once())
167 ->method(
'getCustomization')
168 ->willReturn($customization);
171 $this->assertInstanceOf(
173 $this->object->update(
$theme, $fileContent)