You are here

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

@test @group issue_20 @since 0.11.0

File

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

Class

vfsStreamTestCase
Test for org\bovigo\vfs\vfsStream.

Namespace

org\bovigo\vfs

Code

public function createWorksRecursively() {
  $baseDir = vfsStream::create(array(
    'test' => array(
      'foo' => array(
        'test.txt' => 'hello',
      ),
      'baz.txt' => 'world',
    ),
  ), new vfsStreamDirectory('baseDir'));
  $this
    ->assertTrue($baseDir
    ->hasChildren());
  $this
    ->assertTrue($baseDir
    ->hasChild('test'));
  $test = $baseDir
    ->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');
}