Beispiel #1
0
 /**
  * @coversNothing
  */
 public function testIntegration()
 {
     $address = Address::find(1);
     $purchase = Purchase::find(1);
     $country = Country::find(1);
     $city = City::find(2);
     $this->assertSame($purchase, $address->getPurchase());
     $this->assertSame($city, $address->getCity());
     $this->assertSame($country, $address->getCountry());
 }
Beispiel #2
0
 public static function initialize(Config $config)
 {
     SoftDeleteTrait::initialize($config);
     $config->addRels([new Rel\BelongsTo('city', $config, City::getRepo()), new Rel\BelongsTo('country', $config, Country::getRepo()), new Rel\HasOne('purchase', $config, Purchase::getRepo(), ['foreignKey' => 'billingId'])])->addAsserts([new Assert\Present('firstName'), new Assert\Present('lastName'), new Assert\Present('email'), new Assert\Present('phone'), new Assert\Present('postCode'), new Assert\Present('line1'), new Assert\Email('email')]);
 }
Beispiel #3
0
 /**
  * @covers ::initialize
  */
 public function testInitialize()
 {
     $repo = City::getRepo();
     $this->assertInstanceOf('Harp\\MP\\BelongsTo', $repo->getRel('parent'));
     $this->assertInstanceOf('Harp\\MP\\HasMany', $repo->getRel('children'));
 }