public function vfsStreamDirectoryTestCase::childHandling in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php \org\bovigo\vfs\vfsStreamDirectoryTestCase::childHandling()
test that adding, handling and removing of a child works as expected
@test
File
- vendor/
mikey179/ vfsStream/ src/ test/ php/ org/ bovigo/ vfs/ vfsStreamDirectoryTestCase.php, line 153
Class
Namespace
org\bovigo\vfsCode
public function childHandling() {
$mockChild = $this
->getMock('org\\bovigo\\vfs\\vfsStreamContent');
$mockChild
->expects($this
->any())
->method('getType')
->will($this
->returnValue(vfsStreamContent::TYPE_FILE));
$mockChild
->expects($this
->any())
->method('getName')
->will($this
->returnValue('bar'));
$mockChild
->expects($this
->any())
->method('appliesTo')
->with($this
->equalTo('bar'))
->will($this
->returnValue(true));
$mockChild
->expects($this
->once())
->method('size')
->will($this
->returnValue(5));
$this->dir
->addChild($mockChild);
$this
->assertTrue($this->dir
->hasChild('bar'));
$bar = $this->dir
->getChild('bar');
$this
->assertSame($mockChild, $bar);
$this
->assertEquals(array(
$mockChild,
), $this->dir
->getChildren());
$this
->assertEquals(0, $this->dir
->size());
$this
->assertEquals(5, $this->dir
->sizeSummarized());
$this
->assertTrue($this->dir
->removeChild('bar'));
$this
->assertEquals(array(), $this->dir
->getChildren());
$this
->assertEquals(0, $this->dir
->size());
$this
->assertEquals(0, $this->dir
->sizeSummarized());
}