You are here

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

@test @group issue_14 @group issue_20 @since 0.10.0

File

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

Class

vfsStreamTestCase
Test for org\bovigo\vfs\vfsStream.

Namespace

org\bovigo\vfs

Code

public function setupWorksRecursively() {
  $root = vfsStream::setup('root', null, 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');
}