You are here

public function vfsStreamTestCase::newDirectoryWithSlashAtStart in Zircon Profile 8.0

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

test that correct directory structure is created

@test

File

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

Class

vfsStreamTestCase
Test for org\bovigo\vfs\vfsStream.

Namespace

org\bovigo\vfs

Code

public function newDirectoryWithSlashAtStart() {
  $foo = vfsStream::newDirectory('/foo/bar/baz', 0755);
  $this
    ->assertEquals('foo', $foo
    ->getName());
  $this
    ->assertEquals(0755, $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(0755, $bar
    ->getPermissions());
  $this
    ->assertTrue($bar
    ->hasChild('baz'));
  $baz1 = $bar
    ->getChild('baz');
  $this
    ->assertEquals('baz', $baz1
    ->getName());
  $this
    ->assertEquals(0755, $baz1
    ->getPermissions());
  $baz2 = $foo
    ->getChild('bar/baz');
  $this
    ->assertSame($baz1, $baz2);
}