File tree 3 files changed +44
-2
lines changed
src/Symfony/Component/DependencyInjection 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,6 @@ before_install:
58
58
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
59
59
export COMPOSER_UP='composer update --no-progress --ansi'
60
60
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
61
- find ~/.phpenv -name xdebug.ini -delete
62
61
63
62
nanoseconds () {
64
63
local cmd="date"
@@ -137,6 +136,7 @@ before_install:
137
136
echo extension = memcached.so >> $INI
138
137
fi
139
138
done
139
+ find ~/.phpenv -name xdebug.ini -delete
140
140
141
141
- |
142
142
# Install extra PHP extensions
Original file line number Diff line number Diff line change @@ -79,13 +79,14 @@ public function __construct()
79
79
new ReplaceAliasByActualDefinitionPass (),
80
80
new RemoveAbstractDefinitionsPass (),
81
81
new RemoveUnusedDefinitionsPass (),
82
+ new AnalyzeServiceReferencesPass (),
83
+ new CheckExceptionOnInvalidReferenceBehaviorPass (),
82
84
new InlineServiceDefinitionsPass (new AnalyzeServiceReferencesPass ()),
83
85
new AnalyzeServiceReferencesPass (),
84
86
new DefinitionErrorExceptionPass (),
85
87
]];
86
88
87
89
$ this ->afterRemovingPasses = [[
88
- new CheckExceptionOnInvalidReferenceBehaviorPass (),
89
90
new ResolveHotPathPass (),
90
91
new ResolveNoPreloadPass (),
91
92
new AliasDeprecatedPublicServicesPass (),
Original file line number Diff line number Diff line change @@ -1337,6 +1337,47 @@ public function testNoClassFromNsSeparatorId()
1337
1337
$ container ->compile ();
1338
1338
}
1339
1339
1340
+ public function testGetThrownServiceNotFoundExceptionWithCorrectServiceId ()
1341
+ {
1342
+ $ this ->expectException (ServiceNotFoundException::class);
1343
+ $ this ->expectExceptionMessage ('The service "child_service" has a dependency on a non-existent service "non_existent_service". ' );
1344
+
1345
+ $ container = new ContainerBuilder ();
1346
+ $ container ->register ('child_service ' , \stdClass::class)
1347
+ ->setPublic (false )
1348
+ ->addArgument ([
1349
+ 'non_existent ' => new Reference ('non_existent_service ' ),
1350
+ ])
1351
+ ;
1352
+ $ container ->register ('parent_service ' , \stdClass::class)
1353
+ ->setPublic (true )
1354
+ ->addArgument ([
1355
+ 'child_service ' => new Reference ('child_service ' ),
1356
+ ])
1357
+ ;
1358
+
1359
+ $ container ->compile ();
1360
+ }
1361
+
1362
+ public function testUnusedServiceRemovedByPassAndServiceNotFoundExceptionWasNotThrown ()
1363
+ {
1364
+ $ container = new ContainerBuilder ();
1365
+ $ container ->register ('service ' , \stdClass::class)
1366
+ ->setPublic (false )
1367
+ ->addArgument ([
1368
+ 'non_existent_service ' => new Reference ('non_existent_service ' ),
1369
+ ])
1370
+ ;
1371
+
1372
+ try {
1373
+ $ container ->compile ();
1374
+ } catch (ServiceNotFoundException $ e ) {
1375
+ $ this ->fail ('Should not be thrown ' );
1376
+ }
1377
+
1378
+ $ this ->addToAssertionCount (1 );
1379
+ }
1380
+
1340
1381
public function testServiceLocator ()
1341
1382
{
1342
1383
$ container = new ContainerBuilder ();
You can’t perform that action at this time.
0 commit comments