コード例 #1
0
 /**
  * @covers Aws\CloudTrail\CloudTrailClient::factory
  */
 public function testFactoryInitializesClient()
 {
     $client = CloudTrailClient::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://cloudtrail.us-west-2.amazonaws.com', $client->getBaseUrl());
 }
コード例 #2
0
 /**
  * @covers Aws\CloudTrail\LogFileIterator::forTrail
  */
 public function testFactoryErrorsOnUnknownBucket()
 {
     $this->setExpectedException('InvalidArgumentException');
     $s3Client = $this->getMockS3Client();
     $cloudTrailClient = CloudTrailClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $cloudTrailClient->addSubscriber(new MockPlugin(array(new Response(200, null, '{"trailList":[]}'))));
     $files = LogFileIterator::forTrail($s3Client, $cloudTrailClient);
 }
コード例 #3
0
 /**
  * @covers Aws\CloudTrail\LogRecordIterator::forTrail
  */
 public function testFactoryCanCreateForTrail()
 {
     $s3Client = $s3Client = S3Client::factory(array('key' => 'foo', 'secret' => 'bar'));
     $cloudTrailClient = CloudTrailClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $json = '{"trailList":[{"IncludeGlobalServiceEvents":true,"Name":"Default","S3BucketName":"log-bucket"}]}';
     $cloudTrailClient->addSubscriber(new MockPlugin(array(new Response(200, null, $json))));
     $records = LogRecordIterator::forTrail($s3Client, $cloudTrailClient);
     $this->assertInstanceOf('Aws\\CloudTrail\\LogRecordIterator', $records);
 }