You are here

public function vfsStreamDirectoryTestCase::addChildReplacesChildWithSameName_Bug_5 in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php \org\bovigo\vfs\vfsStreamDirectoryTestCase::addChildReplacesChildWithSameName_Bug_5()

dd

@test @group regression @group bug_5

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php, line 220

Class

vfsStreamDirectoryTestCase
Test for org\bovigo\vfs\vfsStreamDirectory.

Namespace

org\bovigo\vfs

Code

public function addChildReplacesChildWithSameName_Bug_5() {
  $mockChild1 = $this
    ->getMock('org\\bovigo\\vfs\\vfsStreamContent');
  $mockChild1
    ->expects($this
    ->any())
    ->method('getType')
    ->will($this
    ->returnValue(vfsStreamContent::TYPE_FILE));
  $mockChild1
    ->expects($this
    ->any())
    ->method('getName')
    ->will($this
    ->returnValue('bar'));
  $mockChild2 = $this
    ->getMock('org\\bovigo\\vfs\\vfsStreamContent');
  $mockChild2
    ->expects($this
    ->any())
    ->method('getType')
    ->will($this
    ->returnValue(vfsStreamContent::TYPE_FILE));
  $mockChild2
    ->expects($this
    ->any())
    ->method('getName')
    ->will($this
    ->returnValue('bar'));
  $this->dir
    ->addChild($mockChild1);
  $this
    ->assertTrue($this->dir
    ->hasChild('bar'));
  $this
    ->assertSame($mockChild1, $this->dir
    ->getChild('bar'));
  $this->dir
    ->addChild($mockChild2);
  $this
    ->assertTrue($this->dir
    ->hasChild('bar'));
  $this
    ->assertSame($mockChild2, $this->dir
    ->getChild('bar'));
}