/**
  * @covers Aws\DirectConnect\DirectConnectClient::factory
  */
 public function testFactoryInitializesClient()
 {
     $client = DirectConnectClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $client->getSignature());
     $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials());
     $this->assertEquals('https://directconnect.us-west-2.amazonaws.com', $client->getBaseUrl());
 }
 public function testBasicOperations()
 {
     self::log('Get an offering ID and region to use.');
     $offerings = $this->client->describeOfferings()->get('offerings');
     $offering = $offerings[array_rand($offerings)];
     $this->client->setRegion($offering['region']);
     self::log('Create a connection and make sure it is in the requested state.');
     $result = $this->client->createConnection(array('connectionName' => 'PHP Integ Test Connection', 'offeringId' => $offering['offeringId']));
     $connectionId = $result->get('connectionId');
     $this->assertEquals(ConnectionState::REQUESTED, $result->get('connectionState'));
     self::log('Iterate through the connections and make sure the new one is there.');
     $found = false;
     foreach ($this->client->getIterator('DescribeConnections') as $connection) {
         if ($connection['connectionId'] == $connectionId) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found);
     self::log('Delete the connection and make sure it is in the deleted state.');
     $result = $this->client->deleteConnection(array('connectionId' => $connectionId));
     $this->assertEquals(ConnectionState::DELETED, $result->get('connectionState'));
 }