Example #1
0
 /**
  * @covers ::getErrors
  * @covers ::isEmptyErrors
  * @covers ::validate
  */
 public function testErrors()
 {
     $model = new Model();
     $this->assertInstanceOf('Harp\\Validate\\Errors', $model->getErrors());
     $this->assertCount(0, $model->getErrors());
     $this->assertTrue($model->isEmptyErrors());
     $model->name = null;
     $model->other = null;
     $result = $model->validate();
     $this->assertFalse($result);
     $this->assertInstanceOf('Harp\\Validate\\Errors', $model->getErrors());
     $this->assertCount(2, $model->getErrors());
     $this->assertFalse($model->isEmptyErrors());
     $this->assertCount(1, $model->getErrors()->onlyFor('name'));
     $this->assertCount(1, $model->getErrors()->onlyFor('other'));
 }