You are here

public function FileTest::testMoveToAnUnexistentDirectory in Zircon Profile 8

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

File

vendor/symfony/http-foundation/Tests/File/FileTest.php, line 145

Class

FileTest

Namespace

Symfony\Component\HttpFoundation\Tests\File

Code

public function testMoveToAnUnexistentDirectory() {
  $sourcePath = __DIR__ . '/Fixtures/test.copy.gif';
  $targetDir = __DIR__ . '/Fixtures/directory/sub';
  $targetPath = $targetDir . '/test.copy.gif';
  @unlink($sourcePath);
  @unlink($targetPath);
  @rmdir($targetDir);
  copy(__DIR__ . '/Fixtures/test.gif', $sourcePath);
  $file = new File($sourcePath);
  $movedFile = $file
    ->move($targetDir);
  $this
    ->assertFileExists($targetPath);
  $this
    ->assertFileNotExists($sourcePath);
  $this
    ->assertEquals(realpath($targetPath), $movedFile
    ->getRealPath());
  @unlink($sourcePath);
  @unlink($targetPath);
  @rmdir($targetDir);
}