/** * @covers \Magento\Framework\View\Design\Theme\Image::uploadPreviewImage */ public function testUploadPreviewImage() { $scope = 'test_scope'; $tmpFilePath = '/media_path/tmp/temporary.png'; $this->_themeMock->setData($this->_getThemeSampleData()); $this->_themeMock->setData('preview_image', 'test.png'); $this->_uploaderMock->expects($this->once())->method('uploadPreviewImage')->with($scope, '/media_path/tmp')->will($this->returnValue($tmpFilePath)); $this->_mediaDirectoryMock->expects($this->at(0))->method('getRelativePath')->will($this->returnArgument(0)); $this->_mediaDirectoryMock->expects($this->at(1))->method('delete')->with($this->stringContains('test.png')); $this->_mediaDirectoryMock->expects($this->at(2))->method('delete')->with($tmpFilePath); $this->_model->uploadPreviewImage($scope); }