/** * @depends testConstructor * @param UploadedFile $uploadedFile * @return UploadedFile */ public function testMoveTo(UploadedFile $uploadedFile) { $tempName = uniqid('file-'); $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $tempName; $uploadedFile->moveTo($path); $this->assertFileExists($path); unlink($path); return $uploadedFile; }
public function testCannotRetrieveStreamAfterMove() { $this->setExpectedException("RuntimeException", "File has already been moved"); $stream = new Stream("php://temp", "wb+"); $stream->write("test"); $upload = new UploadedFile($stream, 1, UPLOAD_ERR_OK); $upload->moveTo(__DIR__ . "/tmpfile"); $this->assertTrue(file_exists(__DIR__ . "/tmpfile")); $upload->getStream(); }