4
4
5
5
use AppKernel ;
6
6
use Aws \AwsClient ;
7
- use Aws \Sdk ;
8
- use ReflectionClass ;
7
+ use PHPUnit \Framework \TestCase ;
9
8
use Symfony \Component \DependencyInjection \ContainerBuilder ;
10
9
use Symfony \Component \DependencyInjection \ContainerInterface ;
11
10
use Symfony \Component \DependencyInjection \Reference ;
12
11
13
- class AwsExtensionTest extends \PHPUnit_Framework_TestCase
12
+ class AwsExtensionTest extends TestCase
14
13
{
15
14
/**
16
15
* @var ContainerInterface
@@ -81,7 +80,9 @@ public function extension_should_escape_strings_that_begin_with_at_sign()
81
80
'key ' => '@@key ' ,
82
81
'secret ' => '@@secret '
83
82
]];
84
- $ container = $ this ->getMock (ContainerBuilder::class, ['getDefinition ' , 'replaceArgument ' ]);
83
+ $ container = $ this ->getMockBuilder (ContainerBuilder::class)
84
+ ->setMethods (['getDefinition ' , 'replaceArgument ' ])
85
+ ->getMock ();
85
86
$ container ->expects ($ this ->once ())
86
87
->method ('getDefinition ' )
87
88
->with ('aws_sdk ' )
@@ -107,7 +108,9 @@ public function extension_should_expand_service_references()
107
108
{
108
109
$ extension = new AwsExtension ;
109
110
$ config = ['credentials ' => '@aws_sdk ' ];
110
- $ container = $ this ->getMock (ContainerBuilder::class, ['getDefinition ' , 'replaceArgument ' ]);
111
+ $ container = $ this ->getMockBuilder (ContainerBuilder::class)
112
+ ->setMethods (['getDefinition ' , 'replaceArgument ' ])
113
+ ->getMock ();
111
114
$ container ->expects ($ this ->once ())
112
115
->method ('getDefinition ' )
113
116
->with ('aws_sdk ' )
@@ -157,4 +160,20 @@ function (array $service) use ($config) {
157
160
$ this ->serviceProvider ()
158
161
);
159
162
}
163
+
164
+ /**
165
+ * @test
166
+ *
167
+ * @dataProvider serviceProvider
168
+ */
169
+ public function extension_should_load_services_by_class_name (
170
+ $ webServiceName ,
171
+ $ containerServiceName ,
172
+ $ clientClassName
173
+ ) {
174
+ $ this ->assertInstanceOf (
175
+ $ clientClassName ,
176
+ $ this ->container ->get ($ clientClassName )
177
+ );
178
+ }
160
179
}
0 commit comments