getIterator() public method

public getIterator ( ) : Iterator
return Iterator iterator
Esempio n. 1
0
 public function testGetIterator()
 {
     $list = new TPagedList(array(1, 2));
     $list->CustomPaging = true;
     self::assertInstanceOf('ArrayIterator', $list->getIterator());
     $n = 0;
     $found = 0;
     foreach ($list as $index => $item) {
         foreach ($list as $a => $b) {
         }
         // test of iterator
         $n++;
         if ($index === 0 && $item === 1) {
             $found++;
         }
         if ($index === 1 && $item === 2) {
             $found++;
         }
     }
     self::assertTrue($n == 2 && $found == 2);
 }