Class FsFixture
Materializes a directory tree under a real temporary directory so tests can exercise real iterators against a known fixture layout.
Method Summary
-
create() public static
Add files and directories to an existing root.
-
path() public static
Build the absolute path for a subpath of a previously created root.
-
setup() public static
Create a root directory containing
$structureand return its absolute path. Any pre-existing root with the same name is removed. -
tearDown() public static
Remove the per-process root and all its contents.
Method Detail
create() ¶ public static
create(array $structure, string $parent): void
Add files and directories to an existing root.
Parameters
-
array$structure Nested arrays create directories; string values are written as file contents.
-
string$parent Absolute path of the directory to create in.
Returns
voidpath() ¶ public static
path(string $name): string
Build the absolute path for a subpath of a previously created root.
Parameters
-
string$name Root name and optional relative path, e.g.
root/src.
Returns
stringsetup() ¶ public static
setup(string $rootDirName, array $structure = []): string
Create a root directory containing $structure and return its
absolute path. Any pre-existing root with the same name is removed.
Parameters
-
string$rootDirName Name of the root directory.
-
array$structure optional Nested arrays create directories; string values are written as file contents.
Returns
stringAbsolute path to the new root directory.
tearDown() ¶ public static
tearDown(): void
Remove the per-process root and all its contents.
Returns
void