Skip to content

Commit 684c1e5

Browse files
committed
Add test for using service provider in Lumen
1 parent 11fd1a7 commit 684c1e5

File tree

4 files changed

+43
-18
lines changed

4 files changed

+43
-18
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
"illuminate/support": "~5.1"
1818
},
1919
"require-dev": {
20-
"laravel/framework": "~5.1",
21-
"phpunit/phpunit": "~4.0"
20+
"laravel/framework": "~5.2",
21+
"phpunit/phpunit": "~4.0",
22+
"laravel/lumen-framework": "~5.2"
2223
},
2324
"autoload": {
2425
"psr-4": { "Aws\\Laravel\\": "src/" }

tests/AwsServiceProviderTest.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
use Aws\Laravel\AwsFacade as AWS;
44
use Aws\Laravel\AwsServiceProvider;
5-
use Illuminate\Config\Repository;
6-
use Illuminate\Foundation\Application;
5+
use Illuminate\Container\Container;
76

8-
class AwsServiceProviderTest extends \PHPUnit_Framework_TestCase
7+
abstract class AwsServiceProviderTest extends \PHPUnit_Framework_TestCase
98
{
109

1110
public function testFacadeCanBeResolvedToServiceInstance()
@@ -61,24 +60,16 @@ public function testVersionInformationIsProvidedToSdkUserAgent()
6160
}
6261

6362
/**
64-
* @return Application
63+
* @return Container
6564
*/
66-
private function setupApplication()
67-
{
68-
// Create the application such that the config is loaded.
69-
$app = new Application();
70-
$app->setBasePath(sys_get_temp_dir());
71-
$app->instance('config', new Repository());
72-
73-
return $app;
74-
}
65+
abstract protected function setupApplication();
7566

7667
/**
77-
* @param Application $app
68+
* @param Container $app
7869
*
7970
* @return AwsServiceProvider
8071
*/
81-
private function setupServiceProvider(Application $app)
72+
private function setupServiceProvider(Container $app)
8273
{
8374
// Create and register the provider.
8475
$provider = new AwsServiceProvider($app);
@@ -87,5 +78,4 @@ private function setupServiceProvider(Application $app)
8778

8879
return $provider;
8980
}
90-
9181
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php namespace Aws\Laravel\Test;
2+
3+
use Illuminate\Config\Repository;
4+
use Illuminate\Foundation\Application;
5+
6+
class LaravelAwsServiceProviderTest extends AwsServiceProviderTest
7+
{
8+
protected function setupApplication()
9+
{
10+
// Create the application such that the config is loaded.
11+
$app = new Application();
12+
$app->setBasePath(sys_get_temp_dir());
13+
$app->instance('config', new Repository());
14+
15+
return $app;
16+
}
17+
}

tests/LumenAwsServiceProviderTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace Aws\Laravel\Test;
3+
4+
use Illuminate\Config\Repository;
5+
use Laravel\Lumen\Application;
6+
7+
class LumenAwsServiceProviderTest extends AwsServiceProviderTest
8+
{
9+
protected function setupApplication()
10+
{
11+
// Create the application such that the config is loaded.
12+
$app = new Application(sys_get_temp_dir());
13+
$app->instance('config', new Repository());
14+
15+
return $app;
16+
}
17+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy