From 430a5156d3bff5d2dfd02dc4f0c558975fc6285b Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 7 Jun 2018 12:43:25 +0200 Subject: [PATCH] FileMutator: fixes --- src/Framework/FileMutator.php | 15 +-- tests/Framework/FileMutator.errors.phpt | 148 ++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 7 deletions(-) create mode 100644 tests/Framework/FileMutator.errors.phpt diff --git a/src/Framework/FileMutator.php b/src/Framework/FileMutator.php index 925f1cee..6e215d92 100644 --- a/src/Framework/FileMutator.php +++ b/src/Framework/FileMutator.php @@ -60,7 +60,7 @@ public function dir_rewinddir() public function mkdir($path, $mode, $options) { - return $this->native('mkdir', $mode, false, $this->context); + return $this->native('mkdir', $path, $mode, false, $this->context); } @@ -72,7 +72,7 @@ public function rename($pathFrom, $pathTo) public function rmdir($path, $options) { - return $this->native('rmdir', $this->context); + return $this->native('rmdir', $path, $this->context); } @@ -110,6 +110,7 @@ public function stream_metadata($path, $option, $value) { switch ($option) { case STREAM_META_TOUCH: + $value += [null, null]; return $this->native('touch', $path, $value[0], $value[1]); case STREAM_META_OWNER_NAME: case STREAM_META_OWNER: @@ -156,7 +157,7 @@ public function stream_read($count) public function stream_seek($offset, $whence = SEEK_SET) { - return fseek($this->handle, $offset, $whence); + return fseek($this->handle, $offset, $whence) === 0; } @@ -197,10 +198,10 @@ public function unlink($path) public function url_stat($path, $flags) { - return $this->native( - $flags & STREAM_URL_STAT_LINK ? 'lstat' : 'stat', - $path - ); + $func = $flags & STREAM_URL_STAT_LINK ? 'lstat' : 'stat'; + return $flags & STREAM_URL_STAT_QUIET + ? @$this->native($func, $path) + : $this->native($func, $path); } diff --git a/tests/Framework/FileMutator.errors.phpt b/tests/Framework/FileMutator.errors.phpt new file mode 100644 index 00000000..10d8cc02 --- /dev/null +++ b/tests/Framework/FileMutator.errors.phpt @@ -0,0 +1,148 @@ +