You are here

public function UploadedFileTest::testMoveLocalFileIsAllowedInTestMode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php \Symfony\Component\HttpFoundation\Tests\File\UploadedFileTest::testMoveLocalFileIsAllowedInTestMode()

File

vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php, line 147

Class

UploadedFileTest

Namespace

Symfony\Component\HttpFoundation\Tests\File

Code

public function testMoveLocalFileIsAllowedInTestMode() {
  $path = __DIR__ . '/Fixtures/test.copy.gif';
  $targetDir = __DIR__ . '/Fixtures/directory';
  $targetPath = $targetDir . '/test.copy.gif';
  @unlink($path);
  @unlink($targetPath);
  copy(__DIR__ . '/Fixtures/test.gif', $path);
  $file = new UploadedFile($path, 'original.gif', 'image/gif', filesize($path), UPLOAD_ERR_OK, true);
  $movedFile = $file
    ->move(__DIR__ . '/Fixtures/directory');
  $this
    ->assertTrue(file_exists($targetPath));
  $this
    ->assertFalse(file_exists($path));
  $this
    ->assertEquals(realpath($targetPath), $movedFile
    ->getRealPath());
  @unlink($targetPath);
}