Exemplo n.º 1
0
 public function testGetIterator()
 {
     $queue = new CQueue(array(1, 2));
     $this->assertInstanceOf('CQueueIterator', $queue->getIterator());
     $n = 0;
     $found = 0;
     foreach ($queue as $index => $item) {
         foreach ($queue as $a => $b) {
         }
         // test of iterator
         $n++;
         if ($index === 0 && $item === 1) {
             $found++;
         }
         if ($index === 1 && $item === 2) {
             $found++;
         }
     }
     $this->assertTrue($n == 2 && $found == 2);
 }