Skip to content

Commit

Permalink
Adding credentials to travis and fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Jul 10, 2014
1 parent 698d45d commit 1ffd7d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -12,7 +12,7 @@ before_script:
- composer self-update
- composer install --no-interaction --prefer-source --dev

script: vendor/bin/phpunit
script: AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar vendor/bin/phpunit

matrix:
allow_failures:
Expand Down
4 changes: 3 additions & 1 deletion tests/Aws/Tests/Common/Client/ClientBuilderTest.php
Expand Up @@ -207,6 +207,9 @@ public function testEnsuresExceptionIsThrownWhenMissingRequiredRegion()
public function testAddsDefaultCredentials()
{
$_SERVER['HOME'] = '/tmp';
unset($_SERVER[Credentials::ENV_KEY], $_SERVER[Credentials::ENV_SECRET]);
putenv('AWS_ACCESS_KEY_ID=');
putenv('AWS_SECRET_KEY=');

$creds = Credentials::factory(array('key' => 'foo', 'secret' => 'bar'));
$config = array(
Expand Down Expand Up @@ -247,7 +250,6 @@ public function testAddsDefaultCredentials()
$client3 = ClientBuilder::factory('Aws\\DynamoDb')->setConfig($config)->build();
$this->assertEquals('server-key', $client3->getCredentials()->getAccessKeyId());
$this->assertEquals('server-secret', $client3->getCredentials()->getSecretKey());
unset($_SERVER[Credentials::ENV_KEY], $_SERVER[Credentials::ENV_SECRET]);

// Ensure that environment credentials are picked up if supplied via AWS_SECRET_ACCESS_KEY
$_SERVER[Credentials::ENV_KEY] = 'server-key';
Expand Down
3 changes: 3 additions & 0 deletions tests/Aws/Tests/Common/Credentials/CredentialsTest.php
Expand Up @@ -140,6 +140,9 @@ public function testFactoryCreatesBasicCredentials()
*/
public function testFactoryCreatesInstanceProfileWhenNoKeysAreProvided()
{
unset($_SERVER[Credentials::ENV_KEY], $_SERVER[Credentials::ENV_SECRET]);
putenv('AWS_ACCESS_KEY_ID=');
putenv('AWS_SECRET_KEY=');
$credentials = Credentials::factory();
$this->assertInstanceOf('Aws\Common\Credentials\RefreshableInstanceProfileCredentials', $credentials);
}
Expand Down

0 comments on commit 1ffd7d8

Please sign in to comment.