/** * Test the preUpdate method - With file, with current file date, new file data == current file data */ public function testPreUpdateWithIphpDeletedFile() { $obj = new DummyEntity(); $args = Mocks::getEventArgsMock($this); $file = Mocks::getIphpFileMock($this); $file->expects($this->once())->method('isDeleted')->will($this->returnValue(true)); $propertyMapping = $this->createFilledPropertyMapping($file, 'file', array('fileName' => 'CURRENT_NAME'), $args); $this->setDataStorageObjectMapping($obj, $propertyMapping); $propertyMapping->expects($this->once())->method('resolveFileName')->with('CURRENT_NAME')->will($this->returnValue('/LOCATION/OF/CURRENT_NAME')); $this->fileStorage->expects($this->once())->method('removeFile')->with('/LOCATION/OF/CURRENT_NAME')->will($this->returnValue(true)); $propertyMapping->expects($this->once())->method('setFileDataPropertyValue')->with(null); $this->fileStorage->expects($this->never())->method('upload'); $this->dataStorage->expects($this->once())->method('recomputeChangeSet')->with($args); $listener = $this->getUploaderListener(); $listener->preUpdate($args); $this->assertEquals($listener->getDeferredObjectNum(), 0); }