File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed
src/Symfony/Component/DependencyInjection Expand file tree Collapse file tree 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 @@ -85,13 +85,14 @@ public function __construct()
85
85
new ReplaceAliasByActualDefinitionPass (),
86
86
new RemoveAbstractDefinitionsPass (),
87
87
new RemoveUnusedDefinitionsPass (),
88
+ new AnalyzeServiceReferencesPass (),
89
+ new CheckExceptionOnInvalidReferenceBehaviorPass (),
88
90
new InlineServiceDefinitionsPass (new AnalyzeServiceReferencesPass ()),
89
91
new AnalyzeServiceReferencesPass (),
90
92
new DefinitionErrorExceptionPass (),
91
93
]];
92
94
93
95
$ this ->afterRemovingPasses = [[
94
- new CheckExceptionOnInvalidReferenceBehaviorPass (),
95
96
new ResolveHotPathPass (),
96
97
new ResolveNoPreloadPass (),
97
98
new AliasDeprecatedPublicServicesPass (),
Original file line number Diff line number Diff line change @@ -1339,6 +1339,47 @@ public function testNoClassFromNsSeparatorId()
1339
1339
$ container ->compile ();
1340
1340
}
1341
1341
1342
+ public function testGetThrownServiceNotFoundExceptionWithCorrectServiceId ()
1343
+ {
1344
+ $ this ->expectException (ServiceNotFoundException::class);
1345
+ $ this ->expectExceptionMessage ('The service "child_service" has a dependency on a non-existent service "non_existent_service". ' );
1346
+
1347
+ $ container = new ContainerBuilder ();
1348
+ $ container ->register ('child_service ' , \stdClass::class)
1349
+ ->setPublic (false )
1350
+ ->addArgument ([
1351
+ 'non_existent ' => new Reference ('non_existent_service ' ),
1352
+ ])
1353
+ ;
1354
+ $ container ->register ('parent_service ' , \stdClass::class)
1355
+ ->setPublic (true )
1356
+ ->addArgument ([
1357
+ 'child_service ' => new Reference ('child_service ' ),
1358
+ ])
1359
+ ;
1360
+
1361
+ $ container ->compile ();
1362
+ }
1363
+
1364
+ public function testUnusedServiceRemovedByPassAndServiceNotFoundExceptionWasNotThrown ()
1365
+ {
1366
+ $ container = new ContainerBuilder ();
1367
+ $ container ->register ('service ' , \stdClass::class)
1368
+ ->setPublic (false )
1369
+ ->addArgument ([
1370
+ 'non_existent_service ' => new Reference ('non_existent_service ' ),
1371
+ ])
1372
+ ;
1373
+
1374
+ try {
1375
+ $ container ->compile ();
1376
+ } catch (ServiceNotFoundException $ e ) {
1377
+ $ this ->fail ('Should not be thrown ' );
1378
+ }
1379
+
1380
+ $ this ->addToAssertionCount (1 );
1381
+ }
1382
+
1342
1383
public function testServiceLocator ()
1343
1384
{
1344
1385
$ container = new ContainerBuilder ();
You can’t perform that action at this time.
0 commit comments