Skip to content
Permalink
Browse files

Add inode support, closes #119

  • Loading branch information...
bizurkur committed Sep 27, 2019
1 parent 5bed16c commit 8e0a8331149f1531b56f0b1b792cfa4c88e4bb37
@@ -1,6 +1,8 @@
2.0.0 (20??-??-??)
------------------

* Add inode support

### BC breaks

* raised minimum required PHP version to 7.2.0
@@ -654,7 +654,7 @@ public function stream_stat(): array
{
$fileStat = [
'dev' => 0,
'ino' => 0,
'ino' => spl_object_id($this->content),
'mode' => $this->content->getType() | $this->content->getPermissions(),
'nlink' => 0,
'uid' => $this->content->getUser(),
@@ -1019,7 +1019,7 @@ public function url_stat(string $path, int $flags)
$fileStat = [
'dev' => 0,
'ino' => 0,
'ino' => spl_object_id($content),
'mode' => $content->getType() | $content->getPermissions(),
'nlink' => 0,
'uid' => $content->getUser(),
@@ -13,7 +13,9 @@
use function bovigo\assert\assertTrue;
use function bovigo\assert\assertFalse;
use function bovigo\assert\assertThat;
use function bovigo\assert\expect;
use function bovigo\assert\predicate\equals;
/**
* Test for unlink() functionality.
*
@@ -59,4 +61,27 @@ public function unlinkNonExistingFileTriggersError()
->triggers()
->withMessage('unlink(vfs://root/foo.txt): No such file or directory');
}
/**
* @test
* @group issue_119
*/
public function unlinkMaintainsInode()
{
$root = vfsStream::setup('root');
$path = $root->url().'/test';
file_put_contents($path, uniqid());
$handle = fopen($path, 'r');
$before = fstat($handle);
unlink($path);
// Prove that we're not getting cached stats
clearstatcache();
$after = fstat($handle);
assertThat($after, equals($before));
}
}
@@ -440,7 +440,7 @@ public function statReturnsFullDataForFiles()
stat($this->fileInRoot->url()),
equals([
0 => 0,
1 => 0,
1 => spl_object_id($this->fileInRoot),
2 => 0100666,
3 => 0,
4 => vfsStream::getCurrentUser(),
@@ -453,7 +453,7 @@ public function statReturnsFullDataForFiles()
11 => -1,
12 => -1,
'dev' => 0,
'ino' => 0,
'ino' => spl_object_id($this->fileInRoot),
'mode' => 0100666,
'nlink' => 0,
'uid' => vfsStream::getCurrentUser(),
@@ -481,7 +481,7 @@ public function statReturnsFullDataForDirectories()
stat($this->root->url()),
equals([
0 => 0,
1 => 0,
1 => spl_object_id($this->root),
2 => 0040777,
3 => 0,
4 => vfsStream::getCurrentUser(),
@@ -494,7 +494,7 @@ public function statReturnsFullDataForDirectories()
11 => -1,
12 => -1,
'dev' => 0,
'ino' => 0,
'ino' => spl_object_id($this->root),
'mode' => 0040777,
'nlink' => 0,
'uid' => vfsStream::getCurrentUser(),
@@ -522,7 +522,7 @@ public function statReturnsFullDataForDirectoriesWithDot()
stat($this->root->url() . '/.'),
equals([
0 => 0,
1 => 0,
1 => spl_object_id($this->root),
2 => 0040777,
3 => 0,
4 => vfsStream::getCurrentUser(),
@@ -535,7 +535,7 @@ public function statReturnsFullDataForDirectoriesWithDot()
11 => -1,
12 => -1,
'dev' => 0,
'ino' => 0,
'ino' => spl_object_id($this->root),
'mode' => 0040777,
'nlink' => 0,
'uid' => vfsStream::getCurrentUser(),

0 comments on commit 8e0a833

Please sign in to comment.
You can’t perform that action at this time.