You are here

public function vfsStreamTestCase::createWorksRecursivelyWithRoot 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::createWorksRecursivelyWithRoot()

@test @group issue_20 @since 0.11.0

File

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

Class

vfsStreamTestCase
Test for org\bovigo\vfs\vfsStream.

Namespace

org\bovigo\vfs

Code

public function createWorksRecursivelyWithRoot() {
  $root = vfsStream::setup();
  $this
    ->assertSame($root, vfsStream::create(array(
    'test' => array(
      'foo' => array(
        'test.txt' => 'hello',
      ),
      'baz.txt' => 'world',
    ),
  )));
  $this
    ->assertTrue($root
    ->hasChildren());
  $this
    ->assertTrue($root
    ->hasChild('test'));
  $test = $root
    ->getChild('test');
  $this
    ->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $test);
  $this
    ->assertTrue($test
    ->hasChildren());
  $this
    ->assertTrue($test
    ->hasChild('baz.txt'));
  $this
    ->assertVfsFile($test
    ->getChild('baz.txt'), 'world');
  $this
    ->assertTrue($test
    ->hasChild('foo'));
  $foo = $test
    ->getChild('foo');
  $this
    ->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $foo);
  $this
    ->assertTrue($foo
    ->hasChildren());
  $this
    ->assertTrue($foo
    ->hasChild('test.txt'));
  $this
    ->assertVfsFile($foo
    ->getChild('test.txt'), 'hello');
}