Closed
Description
Symfony version(s) affected: 4.2.4
Description
class AuthorizationTest extends WebTestCase
{
public function testXxx(): void
{
self::bootKernel();
$security = self::$container->get(Security::class);
// ...
}
}
Throws:
ServiceNotFoundException : The "Symfony\Component\Security\Core\Security" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
The self::$container
is the test container, it should let us access private services.
Am I missing something?
How to reproduce
class AuthorizationTest extends WebTestCase
{
public function testXxx(): void
{
self::bootKernel();
self::$container->get(Security::class);
}
}