vfsStreamDirectoryIssue18TestCase.php in Zircon Profile 8
File
vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php
View source
<?php
namespace org\bovigo\vfs;
class vfsStreamDirectoryIssue18TestCase extends \PHPUnit_Framework_TestCase {
protected $rootDirectory;
public function setUp() {
$this->rootDirectory = vfsStream::newDirectory('/');
$this->rootDirectory
->addChild(vfsStream::newDirectory('var/log/app'));
$dir = $this->rootDirectory
->getChild('var/log/app');
$dir
->addChild(vfsStream::newDirectory('app1'));
$dir
->addChild(vfsStream::newDirectory('app2'));
$dir
->addChild(vfsStream::newDirectory('foo'));
}
public function shouldContainThreeSubdirectories() {
$this
->assertEquals(3, count($this->rootDirectory
->getChild('var/log/app')
->getChildren()));
}
public function shouldContainSubdirectoryFoo() {
$this
->assertTrue($this->rootDirectory
->getChild('var/log/app')
->hasChild('foo'));
$this
->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $this->rootDirectory
->getChild('var/log/app')
->getChild('foo'));
}
public function shouldContainSubdirectoryApp1() {
$this
->assertTrue($this->rootDirectory
->getChild('var/log/app')
->hasChild('app1'));
$this
->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $this->rootDirectory
->getChild('var/log/app')
->getChild('app1'));
}
public function shouldContainSubdirectoryApp2() {
$this
->assertTrue($this->rootDirectory
->getChild('var/log/app')
->hasChild('app2'));
$this
->assertInstanceOf('org\\bovigo\\vfs\\vfsStreamDirectory', $this->rootDirectory
->getChild('var/log/app')
->getChild('app2'));
}
}