/** * Tests that the iterator returns the node name as key. * * @return void */ public function testNodeIteratorLoopWithKey() { $names = array('clazz', 'func', 'method', 'pkg'); $nodes = array(new PHP_Depend_Code_Class('clazz', 0, 'clazz.php'), new PHP_Depend_Code_Function('func', 0), new PHP_Depend_Code_Method('method', 0), new PHP_Depend_Code_Package('pkg')); $it = new PHP_Depend_Code_NodeIterator($nodes); for ($i = 0, $it->rewind(); $it->valid(); ++$i, $it->next()) { $this->assertSame($nodes[$i], $it->current()); $this->assertEquals($names[$i], $it->key()); } }