public function testValidations() { $expectedErrors = array('errors' => array('name' => array('isEmpty' => "Value is required and can't be empty"), 'status' => array('isEmpty' => "Value is required and can't be empty"), 'dueDate' => array('isEmpty' => "Value is required and can't be empty"), 'case' => array('isEmpty' => "Value is required and can't be empty"))); $this->assertFalse($this->task->isValid()); $this->assertEquals($expectedErrors, $this->task->getErrorMessages()); unset($expectedErrors['errors']['name']); $this->task->setName('Test Task'); $this->assertFalse($this->task->isValid()); $this->assertEquals($expectedErrors, $this->task->getErrorMessages()); unset($expectedErrors['errors']['status']); $this->task->setStatus('Not Started'); $this->assertFalse($this->task->isValid()); $this->assertEquals($expectedErrors, $this->task->getErrorMessages()); unset($expectedErrors['errors']['dueDate']); $this->task->setDueDate(new \DateTime('tomorrow')); $this->assertFalse($this->task->isValid()); $this->assertEquals($expectedErrors, $this->task->getErrorMessages()); unset($expectedErrors['errors']['case']); $this->task->setCase(new Lpa()); $this->assertTrue($this->task->isValid()); }