You are here

public function vfsStreamTestCase::newDirectoryStructure in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php \org\bovigo\vfs\vfsStreamTestCase::newDirectoryStructure()

test to create a new directory structure

@test

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php, line 165

Class

vfsStreamTestCase
Test for org\bovigo\vfs\vfsStream.

Namespace

org\bovigo\vfs

Code

public function newDirectoryStructure() {
  $foo = vfsStream::newDirectory('foo/bar/baz');
  $this
    ->assertEquals('foo', $foo
    ->getName());
  $this
    ->assertEquals(0777, $foo
    ->getPermissions());
  $this
    ->assertTrue($foo
    ->hasChild('bar'));
  $this
    ->assertTrue($foo
    ->hasChild('bar/baz'));
  $this
    ->assertFalse($foo
    ->hasChild('baz'));
  $bar = $foo
    ->getChild('bar');
  $this
    ->assertEquals('bar', $bar
    ->getName());
  $this
    ->assertEquals(0777, $bar
    ->getPermissions());
  $this
    ->assertTrue($bar
    ->hasChild('baz'));
  $baz1 = $bar
    ->getChild('baz');
  $this
    ->assertEquals('baz', $baz1
    ->getName());
  $this
    ->assertEquals(0777, $baz1
    ->getPermissions());
  $baz2 = $foo
    ->getChild('bar/baz');
  $this
    ->assertSame($baz1, $baz2);
}