Пример #1
0
 /**
  * @covers ::filter
  */
 public function testFilter()
 {
     $models = [new City(['id' => 10]), new City(['id' => 20])];
     $link = new LinkMany(new Country(), Country::getRepo()->getRel('cities'), $models);
     $result = $link->filter(function ($item) {
         return $item->id == 10;
     });
     $this->assertSame([$models[0]], $result->toArray());
 }