Exemplo n.º 1
0
 public function testGetContainers()
 {
     $containers = $this->rackspace->getContainers();
     $this->assertTrue($containers !== false);
     $found = false;
     foreach ($containers as $container) {
         if ($container->getName() == TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found);
 }
Exemplo n.º 2
0
    /**
     * Test the get of all the containers
     *
     * @return void
     */
    public function testGetContainers()
    {
        $this->_files->getHttpClient()
                    ->setAdapter($this->_httpClientAdapterTest);

        $this->_httpClientAdapterTest->setResponse($this->_loadResponse('../../_files/testAuthenticate'));
        $this->assertTrue($this->_files->authenticate(),'Authentication failed');

        $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__));
        $containers= $this->_files->getContainers();
        $this->assertTrue($this->_files->isSuccessful(),'Get containers failed');
        $this->assertEquals($this->_files->getCountContainers(),3,'Total containers count is wrong');
        $this->assertEquals($this->_files->getSizeContainers(),27809,'Total objects size is wrong');
        $this->assertEquals($this->_files->getCountObjects(),6,'Total objects count is wrong');
        $this->assertEquals($containers[1]->getName(),'foo');
        $this->assertEquals($containers[1]->getObjectCount(),2);
        $this->assertEquals($containers[1]->getSize(),9756);
        $this->assertEquals($containers[2]->getName(),'test');
        $this->assertEquals($containers[2]->getObjectCount(),3);
        $this->assertEquals($containers[2]->getSize(),17839);
    }