Ejemplo n.º 1
0
 public function testDescribeMultipleRegions()
 {
     $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" . "<DescribeRegionsResponse xmlns=\"http://ec2.amazonaws.com/doc/2009-04-04/\">\r\n" . "  <regionInfo>\r\n" . "    <item>\r\n" . "      <regionName>us-east-1</regionName>\r\n" . "      <regionUrl>us-east-1.ec2.amazonaws.com</regionUrl>\r\n" . "    </item>\r\n" . "    <item>\r\n" . "      <regionName>us-west-1</regionName>\r\n" . "      <regionUrl>us-west-1.ec2.amazonaws.com</regionUrl>\r\n" . "    </item>\r\n" . "  </regionInfo>\r\n" . "</DescribeRegionsResponse>";
     $this->adapter->setResponse($rawHttpResponse);
     $response = $this->regionInstance->describe(array('us-east-1', 'us-west-1'));
     $arrRegion = array(array('regionName' => 'us-east-1', 'regionUrl' => 'us-east-1.ec2.amazonaws.com'), array('regionName' => 'us-west-1', 'regionUrl' => 'us-west-1.ec2.amazonaws.com'));
     $this->assertSame($arrRegion, $response);
 }
 public function testDescribeMultipleAvailabilityZones()
 {
     $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" . "<DescribeAvailabilityZonesResponse xmlns=\"http://ec2.amazonaws.com/doc/2009-04-04/\">\r\n" . "  <availabilityZoneInfo>\r\n" . "    <item>\r\n" . "      <zoneName>us-east-1a</zoneName>\r\n" . "      <zoneState>available</zoneState>\r\n" . "    </item>\r\n" . "    <item>\r\n" . "      <zoneName>us-east-1b</zoneName>\r\n" . "      <zoneState>available</zoneState>\r\n" . "    </item>\r\n" . "    <item>\r\n" . "      <zoneName>us-east-1c</zoneName>\r\n" . "      <zoneState>available</zoneState>\r\n" . "    </item>\r\n" . "  </availabilityZoneInfo>\r\n" . "</DescribeAvailabilityZonesResponse>";
     $this->adapter->setResponse($rawHttpResponse);
     $response = $this->Zend_Service_Amazon_Ec2_Availabilityzones->describe();
     $this->assertTrue(is_array($response));
     $arrExpected = array('us-east-1a', 'us-east-1b', 'us-east-1c');
     foreach ($response as $k => $node) {
         $this->assertEquals($arrExpected[$k], $node['zoneName']);
     }
 }