/** * @test * @return void */ public function testBeforeSaveDelete() { $fileServiceName = 'service_name'; $customization = $this->getMockBuilder('Magento\\Framework\\View\\Design\\Theme\\Customization\\FileInterface')->getMock(); $this->fileServiceFactory->expects($this->once())->method('create')->with($fileServiceName)->willReturn($customization); $customization->expects($this->once())->method('prepareFile')->with($this->model)->willReturnSelf(); $customization->expects($this->once())->method('save')->with($this->model)->willReturnSelf(); $customization->expects($this->once())->method('delete')->with($this->model)->willReturnSelf(); $this->model->setData('file_type', $fileServiceName); $this->model->beforeSave(); $this->model->beforeDelete(); }