aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2015-10-29 22:20:43 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-10-29 22:20:43 +0100
commit8c8e4440f4a85e228c76d32c60c642a3dfef37a1 (patch)
treeccaa9d5eee7cf7b75e74a0606f58c12635078461
parent05ef8a289e6ff65c6ab071b4fb49ad725d9154b4 (diff)
downloadIterator-8c8e4440f4a85e228c76d32c60c642a3dfef37a1.zip
Iterator-8c8e4440f4a85e228c76d32c60c642a3dfef37a1.tar.gz
Iterator-8c8e4440f4a85e228c76d32c60c642a3dfef37a1.tar.bz2
Test: Specify file type with `hoa://Test/Vfs`.
-rw-r--r--Test/Unit/Directory.php56
-rw-r--r--Test/Unit/FileSystem.php20
-rw-r--r--Test/Unit/SplFileInfo.php21
3 files changed, 49 insertions, 48 deletions
diff --git a/Test/Unit/Directory.php b/Test/Unit/Directory.php
index 8e75ba8..4222611 100644
--- a/Test/Unit/Directory.php
+++ b/Test/Unit/Directory.php
@@ -54,9 +54,9 @@ class Directory extends Test\Unit\Suite
$this
->given(
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/A'),
- resolve('hoa://Test/Vfs/Root/Aa'),
- resolve('hoa://Test/Vfs/Root/Aaa'),
+ resolve('hoa://Test/Vfs/Root/A?type=file'),
+ resolve('hoa://Test/Vfs/Root/Aa?type=file'),
+ resolve('hoa://Test/Vfs/Root/Aaa?type=file'),
$iterator = new LUT\Directory($root),
$result = []
)
@@ -83,10 +83,10 @@ class Directory extends Test\Unit\Suite
$this
->given(
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/.'),
- resolve('hoa://Test/Vfs/Root/..'),
- resolve('hoa://Test/Vfs/Root/Skip'),
- resolve('hoa://Test/Vfs/Root/Gotcha'),
+ resolve('hoa://Test/Vfs/Root/.?type=directory'),
+ resolve('hoa://Test/Vfs/Root/..?type=directory'),
+ resolve('hoa://Test/Vfs/Root/Skip?type=file'),
+ resolve('hoa://Test/Vfs/Root/Gotcha?type=file'),
$iterator = new LUT\Directory($root)
)
->when($result = $iterator->current())
@@ -124,17 +124,17 @@ class Directory extends Test\Unit\Suite
$this
->given(
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/A'),
- resolve('hoa://Test/Vfs/Root/Aa'),
- resolve('hoa://Test/Vfs/Root/Aaa'),
+ resolve('hoa://Test/Vfs/Root/A?type=file'),
+ resolve('hoa://Test/Vfs/Root/Aa?type=file'),
+ resolve('hoa://Test/Vfs/Root/Aaa?type=file'),
resolve('hoa://Test/Vfs/Root/Foo?type=directory'),
resolve('hoa://Test/Vfs/Root/Foo/Bar?type=directory'),
- resolve('hoa://Test/Vfs/Root/Foo/Bar/B'),
- resolve('hoa://Test/Vfs/Root/Foo/Bar/Bb'),
- resolve('hoa://Test/Vfs/Root/Foo/Bar/Bbb'),
- resolve('hoa://Test/Vfs/Root/Foo/C'),
- resolve('hoa://Test/Vfs/Root/Foo/Cc'),
- resolve('hoa://Test/Vfs/Root/Foo/Ccc'),
+ resolve('hoa://Test/Vfs/Root/Foo/Bar/B?type=file'),
+ resolve('hoa://Test/Vfs/Root/Foo/Bar/Bb?type=file'),
+ resolve('hoa://Test/Vfs/Root/Foo/Bar/Bbb?type=file'),
+ resolve('hoa://Test/Vfs/Root/Foo/C?type=file'),
+ resolve('hoa://Test/Vfs/Root/Foo/Cc?type=file'),
+ resolve('hoa://Test/Vfs/Root/Foo/Ccc?type=file'),
$directory = new LUT\Recursive\Directory($root),
$iterator = new LUT\Recursive\Iterator($directory),
$result = []
@@ -165,12 +165,12 @@ class Directory extends Test\Unit\Suite
->given(
$splFileInfo = 'Hoa\Iterator\SplFileInfo',
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/a'),
- resolve('hoa://Test/Vfs/Root/b'),
- resolve('hoa://Test/Vfs/Root/c'),
- resolve('hoa://Test/Vfs/Root/d'),
- resolve('hoa://Test/Vfs/Root/e'),
- resolve('hoa://Test/Vfs/Root/f'),
+ resolve('hoa://Test/Vfs/Root/a?type=file'),
+ resolve('hoa://Test/Vfs/Root/b?type=file'),
+ resolve('hoa://Test/Vfs/Root/c?type=file'),
+ resolve('hoa://Test/Vfs/Root/d?type=file'),
+ resolve('hoa://Test/Vfs/Root/e?type=file'),
+ resolve('hoa://Test/Vfs/Root/f?type=file'),
$iterator = new LUT\Directory(
$root,
$splFileInfo
@@ -205,14 +205,14 @@ class Directory extends Test\Unit\Suite
$splFileInfo = 'Hoa\Iterator\SplFileInfo',
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
resolve('hoa://Test/Vfs/Root/A?type=directory'),
- resolve('hoa://Test/Vfs/Root/A/a'),
- resolve('hoa://Test/Vfs/Root/A/b'),
- resolve('hoa://Test/Vfs/Root/A/c'),
+ resolve('hoa://Test/Vfs/Root/A/a?type=file'),
+ resolve('hoa://Test/Vfs/Root/A/b?type=file'),
+ resolve('hoa://Test/Vfs/Root/A/c?type=file'),
resolve('hoa://Test/Vfs/Root/B?type=directory'),
- resolve('hoa://Test/Vfs/Root/B/d'),
- resolve('hoa://Test/Vfs/Root/B/e'),
+ resolve('hoa://Test/Vfs/Root/B/d?type=file'),
+ resolve('hoa://Test/Vfs/Root/B/e?type=file'),
resolve('hoa://Test/Vfs/Root/B/c?type=directory'),
- resolve('hoa://Test/Vfs/Root/B/c/f'),
+ resolve('hoa://Test/Vfs/Root/B/c/f?type=file'),
$directory = new LUT\Recursive\Directory(
$root,
LUT\FileSystem::CURRENT_AS_FILEINFO,
diff --git a/Test/Unit/FileSystem.php b/Test/Unit/FileSystem.php
index 50d2673..b2e4fb1 100644
--- a/Test/Unit/FileSystem.php
+++ b/Test/Unit/FileSystem.php
@@ -54,10 +54,10 @@ class FileSystem extends Test\Unit\Suite
$this
->given(
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/.'),
- resolve('hoa://Test/Vfs/Root/..'),
- resolve('hoa://Test/Vfs/Root/A'),
- resolve('hoa://Test/Vfs/Root/B'),
+ resolve('hoa://Test/Vfs/Root/.?type=directory'),
+ resolve('hoa://Test/Vfs/Root/..?type=directory'),
+ resolve('hoa://Test/Vfs/Root/A?type=file'),
+ resolve('hoa://Test/Vfs/Root/B?type=file'),
$iterator = new LUT\FileSystem($root),
$result = []
)
@@ -83,12 +83,12 @@ class FileSystem extends Test\Unit\Suite
->given(
$splFileInfo = 'Hoa\Iterator\SplFileInfo',
$root = resolve('hoa://Test/Vfs/Root?type=directory'),
- resolve('hoa://Test/Vfs/Root/a'),
- resolve('hoa://Test/Vfs/Root/b'),
- resolve('hoa://Test/Vfs/Root/c'),
- resolve('hoa://Test/Vfs/Root/d'),
- resolve('hoa://Test/Vfs/Root/e'),
- resolve('hoa://Test/Vfs/Root/f'),
+ resolve('hoa://Test/Vfs/Root/a?type=file'),
+ resolve('hoa://Test/Vfs/Root/b?type=file'),
+ resolve('hoa://Test/Vfs/Root/c?type=file'),
+ resolve('hoa://Test/Vfs/Root/d?type=file'),
+ resolve('hoa://Test/Vfs/Root/e?type=file'),
+ resolve('hoa://Test/Vfs/Root/f?type=file'),
$iterator = new LUT\FileSystem(
$root,
LUT\FileSystem::CURRENT_AS_FILEINFO,
diff --git a/Test/Unit/SplFileInfo.php b/Test/Unit/SplFileInfo.php
index bcae2b2..a9117db 100644
--- a/Test/Unit/SplFileInfo.php
+++ b/Test/Unit/SplFileInfo.php
@@ -52,7 +52,7 @@ class SplFileInfo extends Test\Unit\Suite
public function case_file()
{
$this
- ->given($pathname = 'hoa://Test/Vfs/Foo.bar')
+ ->given($pathname = 'hoa://Test/Vfs/Foo.bar?type=file')
->when($result = new LUT\SplFileInfo($pathname))
->then
->boolean($result->isFile())
@@ -81,22 +81,22 @@ class SplFileInfo extends Test\Unit\Suite
$relativePathname = 'C/Foo.bar',
$pathname = $relativePath . $relativePathname
)
- ->when($result = new LUT\SplFileInfo($pathname, $relativePath))
+ ->when($result = new LUT\SplFileInfo($pathname . '?type=file', $relativePath))
->then
->boolean($result->isFile())
->isTrue()
->string($result->getBasename())
- ->isEqualTo('Foo.bar')
+ ->isEqualTo('Foo.bar?type=file')
->string($result->getExtension())
- ->isEqualTo('bar')
+ ->isEqualTo('bar?type=file')
->string($result->getRelativePath())
->isEqualTo($relativePath)
->string($result->getRelativePathname())
- ->isEqualTo($relativePathname)
+ ->isEqualTo($relativePathname . '?type=file')
->string($result->getPath())
->isEqualTo('hoa://Test/Vfs/A/B/C')
->string($result->getPathname())
- ->isEqualTo($pathname);
+ ->isEqualTo($pathname . '?type=file');
}
public function case_times()
@@ -113,6 +113,7 @@ class SplFileInfo extends Test\Unit\Suite
$pathname =
'hoa://Test/Vfs/Foo.bar?' .
http_build_query([
+ 'type' => 'file',
'atime' => $atime,
'ctime' => $ctime,
'mtime' => $mtime
@@ -131,7 +132,7 @@ class SplFileInfo extends Test\Unit\Suite
public function case_permissions()
{
$this
- ->given($pathname = 'hoa://Test/Vfs/Fo.bar?permissions=0744')
+ ->given($pathname = 'hoa://Test/Vfs/Fo.bar?type=file&permissions=0744')
->when($result = new LUT\SplFileInfo($pathname))
->then
->boolean($result->isReadable())
@@ -141,7 +142,7 @@ class SplFileInfo extends Test\Unit\Suite
->boolean($result->isExecutable())
->isTrue()
- ->given($pathname = 'hoa://Test/Vfs/Foo.bar?permissions=0644')
+ ->given($pathname = 'hoa://Test/Vfs/Foo.bar?type=file&permissions=0644')
->when($result = new LUT\SplFileInfo($pathname))
->then
->boolean($result->isReadable())
@@ -151,7 +152,7 @@ class SplFileInfo extends Test\Unit\Suite
->boolean($result->isExecutable())
->isFalse()
- ->given($pathname = 'hoa://Test/Vfs/Fooo.bar?permissions=0444')
+ ->given($pathname = 'hoa://Test/Vfs/Fooo.bar?type=file&permissions=0444')
->when($result = new LUT\SplFileInfo($pathname))
->then
->boolean($result->isReadable())
@@ -161,7 +162,7 @@ class SplFileInfo extends Test\Unit\Suite
->boolean($result->isExecutable())
->isFalse()
- ->given($pathname = 'hoa://Test/Vfs/Foooo.bar?permissions=0044')
+ ->given($pathname = 'hoa://Test/Vfs/Foooo.bar?type=file&permissions=0044')
->when($result = new LUT\SplFileInfo($pathname))
->then
->boolean($result->isReadable())