コード例 #1
0
ファイル: LinkManyTest.php プロジェクト: harp-orm/harp
 /**
  * @covers ::current
  * @covers ::key
  * @covers ::next
  * @covers ::rewind
  * @covers ::valid
  */
 public function testIterator()
 {
     $models = [new City(), new City()];
     $link = new LinkMany(new Country(), Country::getRepo()->getRel('cities'), $models);
     $key = $link->key();
     foreach ($link as $i => $item) {
         $this->assertSame(current($models), $item);
         next($models);
     }
 }