Пример #1
0
 /**
  * @dataProvider getTasksProvider
  */
 public function testGetTasks($tasks, $expected)
 {
     $calendarId = 123;
     $query = $this->getMockBuilder('Doctrine\\ORM\\AbstractQuery')->disableOriginalConstructor()->setMethods(['getArrayResult'])->getMockForAbstractClass();
     $query->expects($this->once())->method('getArrayResult')->will($this->returnValue($tasks));
     $this->reminderManager->expects($this->once())->method('applyReminders')->with($expected, 'OroCRM\\Bundle\\TaskBundle\\Entity\\Task');
     $result = $this->normalizer->getTasks($calendarId, $query);
     $this->assertEquals($expected, $result);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function getCalendarEvents($organizationId, $userId, $calendarId, $start, $end, $connections, $extraFields = [])
 {
     if (!$this->myTasksEnabled) {
         return [];
     }
     if ($this->isCalendarVisible($connections, self::MY_TASKS_CALENDAR_ID)) {
         /** @var TaskRepository $repo */
         $repo = $this->doctrineHelper->getEntityRepository('OroCRMTaskBundle:Task');
         $qb = $repo->getTaskListByTimeIntervalQueryBuilder($userId, $start, $end, $extraFields);
         $query = $this->aclHelper->apply($qb);
         return $this->taskCalendarNormalizer->getTasks(self::MY_TASKS_CALENDAR_ID, $query);
     }
     return [];
 }