public function testMoveTo() { $this->setExpectedException('RuntimeException'); $fileData = $_FILES['avatar']; $uploadedFile = new UploadedFile($fileData['tmp_name'], $fileData['error'], $fileData['size'], $fileData['name'], $fileData['type']); $tmpPath = sys_get_temp_dir() . '/phpUxcOtymove'; $uploadedFile->moveTo($tmpPath); $this->assertTrue(file_exists($tmpPath)); $uploadedFile->getStream(); }
public function testMoveToCreatesStreamIfOnlyAFilenameWasProvided() { $this->cleanup[] = $from = tempnam(sys_get_temp_dir(), 'copy_from'); $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'copy_to'); copy(__FILE__, $from); $uploadedFile = new UploadedFile($from, 100, UPLOAD_ERR_OK, basename($from), 'text/plain'); $uploadedFile->moveTo($to); $this->assertFileEquals(__FILE__, $to); }