/** * Test whether getGroup() responds correctly. */ public function testGroupRetrieving() { // test no group defined $tag = new SelectBoxTag(); $this->assertNull($tag->getGroup('foo')); // test groups defined $tag = new SelectBoxTag(); $tag->setContent('<select:group label="foo"> <group:option value="0">Zero</group:option> <group:option value="1" selected="selected">One</group:option> </select:group> <select:group label="bar"> <group:option value="2">Two</group:option> <group:option value="3" selected="selected">Three</group:option> </select:group>'); $tag->onParseTime(); $tag->onAfterAppend(); $this->assertNull($tag->getGroup('not-existing')); $this->assertNotNull($tag->getGroup('foo')); $this->assertNotNull($tag->getGroup('bar')); // test references returned not copies $children = $tag->getChildren(); $keys = array_keys($children); $this->assertEquals(spl_object_hash($children[$keys[0]]), spl_object_hash($tag->getGroup('foo'))); }