/** * double slashes should be replaced by single slash * * @author Gabriel Birke * @test */ public function pathRemovesDoubleSlashes() { // Regular path $this->assertEquals('my/path', vfsStream::path('vfs://my/path')); // Path with double slashes $this->assertEquals('my/path', vfsStream::path('vfs://my//path')); }
/** * returns status of url * * @param string $path path of url to return status for * @param int $flags flags set by the stream API * @return array */ public function url_stat($path, $flags) { $content = $this->getContent($this->resolvePath(vfsStream::path($path))); if (null === $content) { if (($flags & STREAM_URL_STAT_QUIET) != STREAM_URL_STAT_QUIET) { trigger_error(' No such file or directory: ' . $path, E_USER_WARNING); } return false; } $fileStat = array('dev' => 0, 'ino' => 0, 'mode' => $content->getType() | $content->getPermissions(), 'nlink' => 0, 'uid' => $content->getUser(), 'gid' => $content->getGroup(), 'rdev' => 0, 'size' => $content->size(), 'atime' => $content->fileatime(), 'mtime' => $content->filemtime(), 'ctime' => $content->filectime(), 'blksize' => -1, 'blocks' => -1); return array_merge(array_values($fileStat), $fileStat); }
/** * @test * @group issue_34 * @since 1.2.0 */ public function pathIsUpdatedAfterMove() { // move foo/bar/baz1 to foo/baz3 $baz3URL = vfsStream::url('foo/baz3'); $this->assertTrue(rename($this->baz1URL, $baz3URL)); $this->assertEquals(vfsStream::path($baz3URL), $this->baz1->path()); }