public function testGetChartUsageForUpdate() { $username = '******'; $usage = 2314234; $this->config->expects($this->once())->method('getUsername')->willReturn($username); $this->storage->expects($this->once())->method('getStorageUsage')->willReturn($usage); $result = $this->abstractProvider->getChartUsageForUpdate(); $this->assertInstanceOf('OCA\\ocUsageCharts\\Entity\\Storage\\StorageUsage', $result); $this->assertEquals($username, $result->getUsername()); $this->assertEquals($usage, $result->getUsage()); }
/** * Return a CURRENT storage usage for a user * * @return StorageUsage */ public function getChartUsageForUpdate() { $userName = $this->chartConfig->getUsername(); $usage = $this->storage->getStorageUsage($userName); $maximumUsage = $this->storage->getMaximumStorageUsage($userName); return new StorageUsage(new \Datetime(), $usage, $userName, $maximumUsage); }