/** * Test that if the file name property returns a null value * then no file is injected. */ public function testPropertyIsNullWhenFileNamePropertyIsNull() { $obj = $this->getMock('Vich\\UploaderBundle\\Tests\\DummyEntity'); $fileMapping = $this->getMockBuilder('Vich\\UploaderBundle\\Mapping\\PropertyMapping')->disableOriginalConstructor()->getMock(); $fileMapping->expects($this->never())->method('setValue'); $this->storage->expects($this->once())->method('resolvePath')->will($this->returnValue(null)); $inject = new FileInjector($this->storage); $inject->injectFile($obj, $fileMapping); $this->assertNull($obj->getFile()); }