vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.
BSD 3-Clause "New" or "Revised" License
1.42k
stars
102
forks
source link
Directory should not be allowed to move to itself #255
use org\bovigo\vfs\vfsStream;
$root = vfsStream::setup('x');
var_dump($root->url());
// var_dump(unlink($root->url())); // exception is thrown - correct: Operation not permitted
// var_dump(rename($root->url(), $root->url() . '/a/a')); // exception is thrown - correct: No such file or directory
var_dump(rename($root->url(), $root->url() . '/b')); // no exception, but it is wrong - directory can not be moved to itself
var_dump($root->url());
var_dump(is_dir($root->url()));
Code to reproduce:
Current output:
Expected output: