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(); }
/** * @dataProvider nonOkErrorStatus */ public function testGetStreamRaisesExceptionWhenErrorStatusPresent($status) { $uploadedFile = new UploadedFile('not ok', 0, $status); $this->setExpectedException('RuntimeException', 'upload error'); $uploadedFile->getStream(); }