public function testIntegration() { $syntax = new Syntax(); $syntax->meta = "foo"; $syntax->title = "bar"; $it = $syntax->getIterator(); $this->assertEquals(0, $it->count()); $this->assertFalse($it->offsetExists(0)); $rule1 = new Rule($syntax); $this->assertSame($syntax, $rule1->getParent()); $rule1->name = "first"; $syntax->addChild($rule1); $it = $syntax->getIterator(); $this->assertEquals(1, $it->count()); $this->assertTrue($it->offsetExists(0)); $this->assertSame($rule1, $it->offsetGet(0)); $rule2 = new Rule($syntax); $rule2->name = "second"; $this->assertSame($syntax, $rule1->getParent()); $syntax->addChild($rule2); $it = $syntax->getIterator(); $this->assertEquals(2, $it->count()); $this->assertTrue($it->offsetExists(0)); $this->assertSame($rule1, $it->offsetGet(0)); $this->assertTrue($it->offsetExists(1)); $this->assertSame($rule2, $it->offsetGet(1)); }