Merge branch '4.4' into 5.1
* 4.4: [DependencyInjection] Fixed incorrect report for private services if required service does not exist Remove Xdebug from php-extra runs.
This commit is contained in:
commit
2d062df845
@ -58,7 +58,6 @@ before_install:
|
||||
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
|
||||
export COMPOSER_UP='composer update --no-progress --ansi'
|
||||
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
|
||||
find ~/.phpenv -name xdebug.ini -delete
|
||||
|
||||
nanoseconds () {
|
||||
local cmd="date"
|
||||
@ -137,6 +136,7 @@ before_install:
|
||||
echo extension = memcached.so >> $INI
|
||||
fi
|
||||
done
|
||||
find ~/.phpenv -name xdebug.ini -delete
|
||||
|
||||
- |
|
||||
# Install extra PHP extensions
|
||||
|
@ -85,13 +85,14 @@ class PassConfig
|
||||
new ReplaceAliasByActualDefinitionPass(),
|
||||
new RemoveAbstractDefinitionsPass(),
|
||||
new RemoveUnusedDefinitionsPass(),
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new CheckExceptionOnInvalidReferenceBehaviorPass(),
|
||||
new InlineServiceDefinitionsPass(new AnalyzeServiceReferencesPass()),
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new DefinitionErrorExceptionPass(),
|
||||
]];
|
||||
|
||||
$this->afterRemovingPasses = [[
|
||||
new CheckExceptionOnInvalidReferenceBehaviorPass(),
|
||||
new ResolveHotPathPass(),
|
||||
new ResolveNoPreloadPass(),
|
||||
new AliasDeprecatedPublicServicesPass(),
|
||||
|
@ -1339,6 +1339,47 @@ class ContainerBuilderTest extends TestCase
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
public function testGetThrownServiceNotFoundExceptionWithCorrectServiceId()
|
||||
{
|
||||
$this->expectException(ServiceNotFoundException::class);
|
||||
$this->expectExceptionMessage('The service "child_service" has a dependency on a non-existent service "non_existent_service".');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('child_service', \stdClass::class)
|
||||
->setPublic(false)
|
||||
->addArgument([
|
||||
'non_existent' => new Reference('non_existent_service'),
|
||||
])
|
||||
;
|
||||
$container->register('parent_service', \stdClass::class)
|
||||
->setPublic(true)
|
||||
->addArgument([
|
||||
'child_service' => new Reference('child_service'),
|
||||
])
|
||||
;
|
||||
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
public function testUnusedServiceRemovedByPassAndServiceNotFoundExceptionWasNotThrown()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('service', \stdClass::class)
|
||||
->setPublic(false)
|
||||
->addArgument([
|
||||
'non_existent_service' => new Reference('non_existent_service'),
|
||||
])
|
||||
;
|
||||
|
||||
try {
|
||||
$container->compile();
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->fail('Should not be thrown');
|
||||
}
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testServiceLocator()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
Reference in New Issue
Block a user