コード例 #1
0
 public function testCompositeProperties()
 {
     $utilities = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Utilities')->disableOriginalConstructor()->getMock();
     $generator = $this->getMock('\\PHPStats\\Generator\\GeneratorInterface');
     $locale = $this->getMock('\\Faker\\Locale\\LocaleInterface');
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $parent = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Composite\\CompositeInterface')->getMock();
     $parentB = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Composite\\CompositeInterface')->getMock();
     $childA = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Composite\\CompositeInterface')->getMock();
     $childB = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Composite\\CompositeInterface')->getMock();
     $id = 'testnode';
     $internal = $this->getMock('\\Faker\\Components\\Engine\\Common\\Type\\TypeInterface');
     $type = new SelectorNode($id, $event, $internal);
     $type->setParent($parent);
     $this->assertEquals($id, $type->getId());
     $this->assertEquals($event, $type->getEventDispatcher());
     $this->assertEquals($parent, $type->getParent());
     $type->setParent($parentB);
     $this->assertEquals($parentB, $type->getParent());
     $type->addChild($childA);
     $type->addChild($childB);
     $this->assertEquals(array($childA, $childB), $type->getChildren());
 }