13
13
14
14
use PHPUnit \Framework \TestCase ;
15
15
use Symfony \Bridge \PhpUnit \ExpectUserDeprecationMessageTrait ;
16
- use Symfony \Component \DependencyInjection \Exception \InvalidArgumentException ;
17
16
use Symfony \Component \DependencyInjection \Exception \EmptyParameterValueException ;
17
+ use Symfony \Component \DependencyInjection \Exception \InvalidArgumentException ;
18
18
use Symfony \Component \DependencyInjection \Exception \ParameterCircularReferenceException ;
19
19
use Symfony \Component \DependencyInjection \Exception \ParameterNotFoundException ;
20
20
use Symfony \Component \DependencyInjection \Exception \RuntimeException ;
@@ -201,7 +201,7 @@ public function testGetMissingRequiredParameter()
201
201
{
202
202
$ bag = new ParameterBag ();
203
203
204
- $ bag ->nonEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
204
+ $ bag ->cannotBeEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
205
205
206
206
$ this ->expectException (ParameterNotFoundException::class);
207
207
$ this ->expectExceptionMessage ('You have requested a non-existent parameter "bar". Did you forget to configure the "foo.bar" option? ' );
@@ -213,7 +213,7 @@ public function testGetNonEmptyParameterThrowsWhenNullValue()
213
213
{
214
214
$ bag = new ParameterBag ();
215
215
$ bag ->set ('bar ' , null );
216
- $ bag ->nonEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
216
+ $ bag ->cannotBeEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
217
217
218
218
$ this ->expectException (EmptyParameterValueException::class);
219
219
$ this ->expectExceptionMessage ('Did you forget to configure the "foo.bar" option? ' );
@@ -225,7 +225,19 @@ public function testGetNonEmptyParameterThrowsWhenEmptyStringValue()
225
225
{
226
226
$ bag = new ParameterBag ();
227
227
$ bag ->set ('bar ' , '' );
228
- $ bag ->nonEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
228
+ $ bag ->cannotBeEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
229
+
230
+ $ this ->expectException (EmptyParameterValueException::class);
231
+ $ this ->expectExceptionMessage ('Did you forget to configure the "foo.bar" option? ' );
232
+
233
+ $ bag ->get ('bar ' );
234
+ }
235
+
236
+ public function testGetNonEmptyParameterThrowsWhenEmptyArrayValue ()
237
+ {
238
+ $ bag = new ParameterBag ();
239
+ $ bag ->set ('bar ' , []);
240
+ $ bag ->cannotBeEmpty ('bar ' , 'Did you forget to configure the "foo.bar" option? ' );
229
241
230
242
$ this ->expectException (EmptyParameterValueException::class);
231
243
$ this ->expectExceptionMessage ('Did you forget to configure the "foo.bar" option? ' );
0 commit comments