Пример #1
0
 /**
  * Setup for each test
  */
 public function setUp()
 {
     if (!constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED')) {
         $this->markTestSkipped('Zend\\Cloud\\Infrastructure\\Adapter\\Rackspace online tests are not enabled');
     }
     if (!defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER') || !defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY')) {
         $this->markTestSkipped('Constants User and Key have to be set.');
     }
     self::$infrastructure = \Zend\Cloud\Infrastructure\Factory::getAdapter(array(\Zend\Cloud\Infrastructure\Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\\Cloud\\Infrastructure\\Adapter\\Rackspace', \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_USER => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER'), \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_KEY => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY'), \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_REGION => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION')));
     self::$httpClientAdapterSocket = new \Zend\Http\Client\Adapter\Socket();
     self::$infrastructure->getAdapter()->getHttpClient()->setAdapter(self::$httpClientAdapterSocket);
     // terms of use compliance: no more than two queries per second
     sleep(2);
 }
Пример #2
0
    /**
     * Sets up this test case
     *
     * @return void
     */
    public static function setUpBeforeClass()
    {
        if (!constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED')) {
            self::markTestSkipped('Zend\Cloud\Infrastructure\Adapter\Rackspace online tests are not enabled');
        }
        if(!defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER') || !defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY')) {
            self::markTestSkipped('Constants User and Key have to be set.');
        }

        self::$infrastructure = \Zend\Cloud\Infrastructure\Factory::getAdapter(array( 
            \Zend\Cloud\Infrastructure\Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\Cloud\Infrastructure\Adapter\Rackspace', 
            \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_USER   => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER'), 
            \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_KEY    => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY'), 
            \Zend\Cloud\Infrastructure\Adapter\Rackspace::RACKSPACE_REGION => constant('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION')   
        )); 

        self::$httpClientAdapterSocket = new \Zend\Http\Client\Adapter\Socket();


        self::$infrastructure->getAdapter()
                             ->getHttpClient()
                             ->setAdapter(self::$httpClientAdapterSocket);

    }