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 testGetSetTaskCollections()
 {
     $caseItemMock = $this->getMockedClass();
     $emptyCollection = $caseItemMock->getTasks()->toArray();
     $this->assertEmpty($emptyCollection);
     $TaskCollection = new ArrayCollection();
     for ($i = 0; $i < 10; $i++) {
         $task = new Task();
         $task->setId($i);
         $TaskCollection->add($task);
     }
     $caseItemMock->setTasks($TaskCollection);
     $taskCollectionArray = $caseItemMock->getTasks()->toArray();
     $this->assertEquals(count($TaskCollection->toArray()), count($taskCollectionArray));
 }
 public function testSetCompletedDateIsSetWhenCaseStatusSetToCompleted()
 {
     $this->task->setStatus('completed');
     $this->assertNotEmpty($this->task->getCompletedDate());
     $this->assertEquals($this->task->getCompletedDate(), new \DateTime());
 }
 public function testFilterTasks()
 {
     $task = new Task();
     $task->setDateTimeFromString(date('d/m/Y 00:00:00', strtotime('next week')), 'activeDate');
     $this->epa->addTask($task);
     $task2 = new Task();
     $task2->setDateTimeFromString(date('d/m/Y 00:00:00', strtotime('tomorrow')), 'activeDate');
     $this->epa->addTask($task2);
     $task3 = new Task();
     $task3->setDateTimeFromString(date('d/m/Y 00:00:00', strtotime('yesterday')), 'activeDate');
     $this->epa->addTask($task3);
     $this->assertEquals(1, count($this->epa->filterTasks()));
 }