public function testIsInvalidIfNotUploadedFile() { \Upload\FileInfo::setFactory(function ($tmpName, $name) { $fileInfo = $this->getMock('\\Upload\\FileInfo', array('isUploadedFile'), array($tmpName, $name)); $fileInfo->expects($this->any())->method('isUploadedFile')->will($this->returnValue(false)); return $fileInfo; }); $file = new \Upload\File('single', $this->storage); $this->assertFalse($file->isValid()); }