_amazon = new Zend_Service_Amazon_Sqs( constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY') ); $this->_queue_name = constant('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE'); $this->_httpClientAdapterSocket = new Zend_Http_Client_Adapter_Socket(); $this->_amazon->getHttpClient() ->setAdapter($this->_httpClientAdapterSocket); } /** * Test SQS methods * * @return void */ public function testSqs() { try { $queue_url = $this->_amazon->create($this->_queue_name, 45); $timeout = $this->_amazon->getAttribute($queue_url, 'VisibilityTimeout'); $this->assertEquals(45, $timeout, 'VisibilityTimeout attribute is not 45'); $test_msg = 'this is a test'; $this->_amazon->send($queue_url, $test_msg); $messages = $this->_amazon->receive($queue_url); foreach ($messages as $message) { $this->assertEquals($test_msg, $message['body']); } foreach ($messages as $message) { $result = $this->_amazon->deleteMessage($queue_url, $message['handle']); $this->assertTrue($result, 'Message was not deleted'); } $count = $this->_amazon->count($queue_url); $this->assertEquals(0, $count); $this->_amazon->delete($queue_url); } catch (Exception $e) { $this->fail($e->getMessage()); } } /** * Tear down the test case * * @return void */ public function tearDown() { unset($this->_amazon); } } class Zend_Service_Amazon_Sqs_OnlineTest_Skip extends PHPUnit_Framework_TestCase { public function setUp() { $this->markTestSkipped( 'Zend_Service_Amazon_Sqs online tests not enabled with an access key ID in ' . 'TestConfiguration.php' ); } public function testNothing() { } }