mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Hotfix testing private service in Symfony < 5.3
https://github.com/nelmio/NelmioApiDocBundle/runs/3031148906?check_suite_focus=true#step:7:106 Error: Call to undefined method Nelmio\ApiDocBundle\Tests\Render\Html\GetNelmioAssetTest::getContainer() https://symfony.com/blog/new-in-symfony-4-1-simpler-service-testing In practice, tests based on WebTestCase and KernelTestCase now access to a special container via the static::$container property that allows fetching non-removed private services: https://github.com/symfony/symfony/blob/5.3/CHANGELOG-5.3.md#changelog-for-53x feature #40366 [FrameworkBundle] Add KernelTestCase::getContainer() (Nyholm) static $container @deprecated since Symfony 5.3, use static::getContainer() instead
This commit is contained in:
parent
9cb6006b69
commit
2c890ff93b
@ -22,7 +22,7 @@ class GetNelmioAssetTest extends WebTestCase
|
||||
{
|
||||
static::bootKernel();
|
||||
/** @var GetNelmioAsset $getNelmioAsset */
|
||||
$getNelmioAsset = self::getContainer()->get('nelmio_api_doc.render_docs.html.asset');
|
||||
$getNelmioAsset = static::$container->get('nelmio_api_doc.render_docs.html.asset');
|
||||
$twigFunction = $getNelmioAsset->toTwigFunction($mode);
|
||||
self::assertSame($expectedContent, $twigFunction->getCallable()->__invoke($asset, $mode));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user