Esempio n. 1
0
 /**
  * @covers ::loadLink
  */
 public function testLoadLink()
 {
     $repo = City::getRepo();
     $city = City::find(1);
     $country = Country::find(1);
     $link = $repo->loadLink($city, 'country', State::DELETED);
     $this->assertSame($country, $link->get());
 }
Esempio n. 2
0
 /**
  * @covers ::all
  */
 public function testGetLinkMany()
 {
     $country = Country::find(1);
     $city = City::find(1);
     $cities = $country->all('cities');
     $this->assertSame($cities, Country::getRepo()->loadLink($country, 'cities'));
     $this->setExpectedException('LogicException', 'Rel country in Harp\\Harp\\Test\\TestModel\\City must be a link of a HasMany, HasManyThrough or other AbstractRelMany');
     $city->all('country');
 }