Skip to content

Commit aed91c4

Browse files
committed
Updated tests and configuration; 100% code coverage
1 parent 7c0e9ef commit aed91c4

File tree

6 files changed

+66
-15
lines changed

6 files changed

+66
-15
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
composer.lock
22
composer.phar
3-
phpunit.xml
43
vendor

phpunit.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="./tests/bootstrap.php"
5+
colors="false"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false">
12+
13+
<testsuites>
14+
<testsuite name="AwsServiceProvider Test Suite">
15+
<directory>./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist addUncoveredFilesFromWhitelist="false">
21+
<directory suffix=".php">src</directory>
22+
<exclude>
23+
<directory suffix=".php">vendor</directory>
24+
</exclude>
25+
</whitelist>
26+
</filter>
27+
</phpunit>

phpunit.xml.dist

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/Aws/Laravel/Test/AwsServiceProviderTest.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ public function testRegisterAwsServiceProviderWithGlobalConfig()
2626
$app = $this->setupApplication();
2727
$this->setupServiceProvider($app);
2828

29-
// Simulate global config
29+
// Simulate global config; specify config file
3030
$app['config']->set('aws', array(
31-
'key' => 'FOO',
32-
'secret' => 'BAR',
31+
'config_file' => __DIR__ . '/test_services.json'
3332
));
3433

3534
// Get an instance of a client (S3)
@@ -38,8 +37,8 @@ public function testRegisterAwsServiceProviderWithGlobalConfig()
3837
$this->assertInstanceOf('Aws\S3\S3Client', $s3);
3938

4039
// Verify that the client received the credentials from the global config
41-
$this->assertEquals('FOO', $s3->getCredentials()->getAccessKeyId());
42-
$this->assertEquals('BAR', $s3->getCredentials()->getSecretKey());
40+
$this->assertEquals('change_me', $s3->getCredentials()->getAccessKeyId());
41+
$this->assertEquals('change_me', $s3->getCredentials()->getSecretKey());
4342

4443
// Make sure the user agent contains Laravel information
4544
$command = $s3->getCommand('ListBuckets');
@@ -62,4 +61,11 @@ public function testRegisterAwsServiceProviderWithPackageConfig()
6261
$this->assertEquals('YOUR_AWS_ACCESS_KEY_ID', $s3->getCredentials()->getAccessKeyId());
6362
$this->assertEquals('YOUR_AWS_SECRET_KEY', $s3->getCredentials()->getSecretKey());
6463
}
64+
65+
public function testServiceNameIsProvided()
66+
{
67+
$app = $this->setupApplication();
68+
$provider = $this->setupServiceProvider($app);
69+
$this->assertContains('aws', $provider->provides());
70+
}
6571
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"includes": ["_aws"],
3+
"services": {
4+
"default_settings": {
5+
"params": {
6+
"key": "change_me",
7+
"secret": "change_me",
8+
"region": "us-east-1",
9+
"ssl.certificate_authority": true
10+
}
11+
},
12+
"cloudfront": {
13+
"extends": "cloudfront",
14+
"params": {
15+
"private_key": "change_me",
16+
"key_pair_id": "change_me"
17+
}
18+
}
19+
}
20+
}

tests/bootstrap.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?php
22

3+
// Make sure Composer has been run
4+
if (!file_exists(__DIR__ . '/../composer.lock')) {
5+
die('You must do a Composer install before running the tests.');
6+
}
7+
8+
// Include Composer autoloader
39
require_once __DIR__ . '/../vendor/autoload.php';
10+
11+
// Include the base test class that doesn't get autoloaded
412
require_once __DIR__ . '/Aws/Laravel/Test/AwsServiceProviderTestCase.php';

0 commit comments

Comments
 (0)