コード例 #1
0
 /**
  * Return the chart data you want to return based on the ChartConfig
  *
  * @param User $user
  * @param ActivityUsageRepository|StorageUsageRepository $repository
  * @param ChartConfig $chartConfig
  * @return mixed
  */
 public function getChartUsage(User $user, $repository, ChartConfig $chartConfig)
 {
     if ($user->isAdminUser($user->getSignedInUsername())) {
         $data = $repository->findAllPerMonth();
     } else {
         $data = $repository->findAllPerMonth($chartConfig->getUsername());
     }
     return $data;
 }
コード例 #2
0
 public function testSaveFalse()
 {
     $usageMock = $this->getMockBuilder('OCA\\ocUsageCharts\\Entity\\Storage\\StorageUsage')->disableOriginalConstructor()->getMock();
     $this->repository->expects($this->once())->method('save')->willReturn(false);
     $result = $this->abstractProvider->save($usageMock);
     $this->assertFalse($result);
 }
コード例 #3
0
 /**
  * Save the usage
  *
  * @param StorageUsage $usage
  * @return boolean
  */
 public function save($usage)
 {
     return $this->repository->save($usage);
 }