/** * Setup for each test */ public function setUp() { if (!constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED')) { $this->markTestSkipped('Zend\\Cloud\\Infrastructure\\Adapter\\Ec2 online tests are not enabled'); } if (!defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID') || !defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY')) { $this->markTestSkipped('Constants AccessKeyId and SecretKey have to be set.'); } self::$infrastructure = Factory::getAdapter(array(Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\\Cloud\\Infrastructure\\Adapter\\Ec2', Ec2::AWS_ACCESS_KEY => constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), Ec2::AWS_SECRET_KEY => constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY'), Ec2::AWS_REGION => constant('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE'))); self::$httpClientAdapterSocket = new Socket(); self::$infrastructure->getAdapter()->getHttpClient()->setAdapter(self::$httpClientAdapterSocket); // terms of use compliance: no more than two queries per second sleep(2); }
/** * Sets up this test case * * @return void */ public static function setUpBeforeClass() { if (!constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED')) { self::markTestSkipped('Zend\Cloud\Infrastructure\Adapter\Ec2 online tests are not enabled'); } if(!defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID') || !defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY')) { self::markTestSkipped('Constants AccessKeyId and SecretKey have to be set.'); } self::$infrastructure = Factory::getAdapter(array( Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\Cloud\Infrastructure\Adapter\Ec2', Ec2::AWS_ACCESS_KEY => constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), Ec2::AWS_SECRET_KEY => constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY'), Ec2::AWS_REGION => constant('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE') )); self::$httpClientAdapterSocket = new Socket(); self::$infrastructure->getAdapter() ->getHttpClient() ->setAdapter(self::$httpClientAdapterSocket); }