/**
  * testCurrentReturnsFalseWhenNoMoreElementExists
  *
  * @return void
  * @covers PHP_Depend_Code_NodeIterator
  * @group pdepend
  * @group pdepend::code
  * @group unittest
  */
 public function testCurrentReturnsFalseWhenNoMoreElementExists()
 {
     $iterator = new PHP_Depend_Code_NodeIterator(array());
     $this->assertFalse($iterator->current());
 }
Beispiel #2
0
 /**
  * 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());
     }
 }