/**
  * Update a specific chart
  * @param ChartConfig $chartConfig
  */
 private function updateChart(ChartConfig $chartConfig)
 {
     $usage = $this->dataProvider->getChartUsageForUpdate($chartConfig);
     if (!is_null($usage)) {
         $this->dataProvider->save($chartConfig, $usage);
     }
 }
 public function testSaveDataUsage()
 {
     $provider = $this->getMockBuilder('OCA\\ocUsageCharts\\DataProviders\\Storage\\StorageUsageCurrentProvider')->disableOriginalConstructor()->getMock();
     $provider->expects($this->once())->method('save')->willReturn(true);
     $this->dataProviderFactory->method('getDataProviderByConfig')->willReturn($provider);
     $usageNumber = 2324235;
     $created = new \DateTime();
     $username = '******';
     $maximumUsage = 323232022;
     $usage = $this->getMock('\\OCA\\ocUsageCharts\\Entity\\Storage\\StorageUsage', array(), array($created, $usageNumber, $username, $maximumUsage));
     $saved = $this->dataProvider->save($this->configMock, $usage);
     $this->assertTrue($saved);
 }
 /**
  * Update a specific chart
  * @param ChartConfig $chartConfig
  * @return boolean
  */
 private function updateChart(ChartConfig $chartConfig)
 {
     if (!$this->dataProvider->isAllowedToUpdate($chartConfig)) {
         return false;
     }
     $usage = $this->dataProvider->getChartUsageForUpdate($chartConfig);
     return $this->dataProvider->save($chartConfig, $usage);
 }