@@ 184-196 (lines=13) @@ | ||
181 | $upload->moveTo($path); |
|
182 | } |
|
183 | ||
184 | public function testMoveCannotBeCalledMoreThanOnce() |
|
185 | { |
|
186 | $stream = (new \Nyholm\Psr7\Factory\Psr17Factory())->createStream('Foo bar!'); |
|
187 | $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); |
|
188 | ||
189 | $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac'); |
|
190 | $upload->moveTo($to); |
|
191 | $this->assertTrue(file_exists($to)); |
|
192 | ||
193 | $this->expectException(\RuntimeException::class); |
|
194 | $this->expectExceptionMessage('moved'); |
|
195 | $upload->moveTo($to); |
|
196 | } |
|
197 | ||
198 | public function testCannotRetrieveStreamAfterMove() |
|
199 | { |
|
@@ 198-210 (lines=13) @@ | ||
195 | $upload->moveTo($to); |
|
196 | } |
|
197 | ||
198 | public function testCannotRetrieveStreamAfterMove() |
|
199 | { |
|
200 | $stream = (new \Nyholm\Psr7\Factory\Psr17Factory())->createStream('Foo bar!'); |
|
201 | $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK); |
|
202 | ||
203 | $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac'); |
|
204 | $upload->moveTo($to); |
|
205 | $this->assertFileExists($to); |
|
206 | ||
207 | $this->expectException(\RuntimeException::class); |
|
208 | $this->expectExceptionMessage('moved'); |
|
209 | $upload->getStream(); |
|
210 | } |
|
211 | ||
212 | public function nonOkErrorStatus() |
|
213 | { |