예제 #1
0
 /**
  * @covers ::initialize
  */
 public function testInitialize()
 {
     $address = Address::getRepo();
     $purchase = $address->getRelOrError('purchase');
     $this->assertEquals('CL\\Purchases\\Purchase', $purchase->getRepo()->getModelClass());
     $country = $address->getRelOrError('country');
     $this->assertEquals('Harp\\Locations\\Country', $country->getRepo()->getModelClass());
     $city = $address->getRelOrError('city');
     $this->assertEquals('Harp\\Locations\\City', $city->getRepo()->getModelClass());
     $model = new Address();
     $this->assertFalse($model->validate());
     $errors = $model->getErrors()->humanize();
     $expected = 'firstName must be present, lastName must be present, email must be present, phone must be present, postCode must be present, line1 must be present';
     $this->assertEquals($expected, $errors);
 }