Exemplo n.º 1
0
 public function testGetAvailableSpace()
 {
     if (!$this->_storage instanceof AvailableSpaceCapableInterface) {
         $this->markTestSkipped("Storage doesn't implement AvailableSpaceCapableInterface");
     }
     $availableSpace = $this->_storage->getAvailableSpace();
     $this->assertGreaterThanOrEqual(0, $availableSpace);
     if ($this->_storage instanceof TotalSpaceCapableInterface) {
         $totalSpace = $this->_storage->getTotalSpace();
         $this->assertLessThanOrEqual($totalSpace, $availableSpace);
     }
 }
Exemplo n.º 2
0
 protected function writeCacheStatus(StorageInterface $cache)
 {
     $console = $this->getConsole();
     $human = $this->params('h');
     if ($cache instanceof TotalSpaceCapableInterface) {
         $space = $cache->getTotalSpace();
         $space = $human ? $this->convertToHumanSpace($space) : $space;
         $console->writeLine(sprintf('%s total space', $space));
     } else {
         $console->writeLine('Cache adapter does not provide information about the total space of this cache');
     }
     if ($cache instanceof AvailableSpaceCapableInterface) {
         $space = $cache->getAvailableSpace();
         $space = $human ? $this->convertToHumanSpace($space) : $space;
         $console->writeLine(sprintf('%s available', $space));
     } else {
         $console->writeLine('Cache adapter does not provide information about the available space of this cache');
     }
 }