public function testException()
 {
     $task = new Task();
     try {
         if (false == $task->isValid()) {
             throw new ValidationFailureException(get_class($task));
         }
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof ValidationFailureException);
         $this->assertEquals($e->getMessage(), 'The class ' . get_class($task) . ' has invalid data.');
         $this->assertEquals(InvalidParameterValueException::CODE_DATA_INVALID, $e->getCode());
     }
 }
 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());
 }