Skip to content

[Filesystem] Fixed a bug in remove() being unable to unlink broken symlinks #3811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 7, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Filesystem] Added unit tests for touch method.
  • Loading branch information
jakzal committed Apr 6, 2012
commit a91e200db7cb5d7e9b0315c8bd7056440cec6de1
55 changes: 55 additions & 0 deletions src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,59 @@ public function testMkdirCreatesDirectoriesEvenIfItFailsToCreateOneOfThem()
unlink($basePath.'2');
rmdir($basePath.'3');
}

public function testTouchCreatesEmptyFile()
{
$basePath = sys_get_temp_dir().DIRECTORY_SEPARATOR.time();
$file = $basePath.'1';

$filesystem = new Filesystem();
$filesystem->touch($file);

$this->assertFileExists($basePath.'1');

unlink($basePath.'1');
}

public function testTouchCreatesEmptyFilesFromArray()
{
$basePath = sys_get_temp_dir().DIRECTORY_SEPARATOR.time();
$files = array(
$basePath.'1', $basePath.'2', $basePath.'3'
);
mkdir($basePath);

$filesystem = new Filesystem();
$filesystem->touch($files);

$this->assertFileExists($basePath.'1');
$this->assertFileExists($basePath.'2');
$this->assertFileExists($basePath.'3');

unlink($basePath.'1');
unlink($basePath.'2');
unlink($basePath.'3');
rmdir($basePath);
}

public function testTouchCreatesEmptyFilesFromTraversableObject()
{
$basePath = sys_get_temp_dir().DIRECTORY_SEPARATOR.time();
$files = new \ArrayObject(array(
$basePath.'1', $basePath.'2', $basePath.'3'
));
mkdir($basePath);

$filesystem = new Filesystem();
$filesystem->touch($files);

$this->assertFileExists($basePath.'1');
$this->assertFileExists($basePath.'2');
$this->assertFileExists($basePath.'3');

unlink($basePath.'1');
unlink($basePath.'2');
unlink($basePath.'3');
rmdir($basePath);
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy