public function HttpFoundationFactoryTest::testCreateUploadedFile in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php \Symfony\Bridge\PsrHttpMessage\Tests\Factory\HttpFoundationFactoryTest::testCreateUploadedFile()
File
- vendor/
symfony/ psr-http-message-bridge/ Tests/ Factory/ HttpFoundationFactoryTest.php, line 119
Class
- HttpFoundationFactoryTest
- @author Kévin Dunglas <dunglas@gmail.com>
Namespace
Symfony\Bridge\PsrHttpMessage\Tests\FactoryCode
public function testCreateUploadedFile() {
$uploadedFile = $this
->createUploadedFile('An uploaded file.', UPLOAD_ERR_OK, 'myfile.txt', 'text/plain');
$symfonyUploadedFile = $this
->callCreateUploadedFile($uploadedFile);
$uniqid = uniqid();
$symfonyUploadedFile
->move($this->tmpDir, $uniqid);
$this
->assertEquals($uploadedFile
->getSize(), $symfonyUploadedFile
->getClientSize());
$this
->assertEquals(UPLOAD_ERR_OK, $symfonyUploadedFile
->getError());
$this
->assertEquals('myfile.txt', $symfonyUploadedFile
->getClientOriginalName());
$this
->assertEquals('txt', $symfonyUploadedFile
->getClientOriginalExtension());
$this
->assertEquals('text/plain', $symfonyUploadedFile
->getClientMimeType());
$this
->assertEquals('An uploaded file.', file_get_contents($this->tmpDir . '/' . $uniqid));
}