/** * Tests Zend_Service_Amazon_Ec2_Instance_Reserved->purchaseOffering() */ public function testPurchaseOffering() { $rawHttpResponse = "HTTP/1.1 200 OK\r\n" . "Date: Fri, 24 Oct 2008 17:24:52 GMT\r\n" . "Server: hi\r\n" . "Last-modified: Fri, 24 Oct 2008 17:24:52 GMT\r\n" . "Status: 200 OK\r\n" . "Content-type: application/xml; charset=utf-8\r\n" . "Expires: Tue, 31 Mar 1981 05:00:00 GMT\r\n" . "Connection: close\r\n" . "\r\n" . "<PurchaseReservedInstancesOfferingResponse xmlns=\"http://ec2.amazonaws.com/doc/2009-04-04/\">\r\n" . " <reservedInstancesId>4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8</reservedInstancesId>\r\n" . "</PurchaseReservedInstancesOfferingResponse>"; $this->httpClientTestAdapter->setResponse($rawHttpResponse); $return = $this->instance->purchaseOffering('4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8'); $this->assertSame('4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8', $return); }
/** * Prepares the environment before running a test. */ protected function setUp() { parent::setUp(); $this->instance = new ReservedInstance('access_key', 'secret_access_key'); $adapter = new \Zend\Http\Client\Adapter\Test(); $client = new \Zend\Http\Client(null, array('adapter' => $adapter)); $this->adapter = $adapter; ReservedInstance::setDefaultHTTPClient($client); }