Esempio n. 1
0
 /**
  * @covers ::byRepo
  */
 public function testByRepo()
 {
     $source = [0 => new City(), 1 => new City(), 2 => new Country(), 3 => new City(), 4 => new Country()];
     $models = new Models($source);
     $expected = [[City::getRepo(), [$source[0], $source[1], $source[3]]], [Country::getRepo(), [$source[2], $source[4]]]];
     $i = 0;
     $models->byRepo(function ($repo, Models $repoModels) use($expected, &$i) {
         $this->assertSame($expected[$i][0], $repo);
         $this->assertSame($expected[$i][1], Objects::toArray($repoModels->all()));
         $i++;
     });
 }