@@ -311,7 +311,6 @@ concrete one::
311
311
])
312
312
;
313
313
314
- // the following line won't work unless the alias is made public
315
314
$container->set(NewsRepositoryInterface::class, $newsRepository);
316
315
317
316
// will be injected the mocked repository
@@ -321,52 +320,11 @@ concrete one::
321
320
}
322
321
}
323
322
324
- In order to make the alias public, you will need to update configuration for
325
- the ``test `` environment as follows:
323
+ .. deprecated :: 6.3
326
324
327
- .. configuration-block ::
328
-
329
- .. code-block :: yaml
330
-
331
- # config/services_test.yaml
332
- services :
333
- # redefine the alias as it should be while making it public
334
- App\Contracts\Repository\NewsRepositoryInterface :
335
- alias : App\Repository\NewsRepository
336
- public : true
337
-
338
- .. code-block :: xml
339
-
340
- <!-- config/services_test.xml -->
341
- <?xml version =" 1.0" encoding =" UTF-8" ?>
342
- <container xmlns =" http://symfony.com/schema/dic/services"
343
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
344
- xsi : schemaLocation =" http://symfony.com/schema/dic/services
345
- https://symfony.com/schema/dic/services/services-1.0.xsd
346
- " >
347
- <services >
348
- <!-- redefine the alias as it should be while making it public -->
349
- <service id =" App\Contracts\Repository\NewsRepositoryInterface"
350
- alias =" App\Repository\NewsRepository"
351
- />
352
- </services >
353
- </container >
354
-
355
- .. code-block :: php
356
-
357
- // config/services_test.php
358
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
359
-
360
- use App\Contracts\Repository\NewsRepositoryInterface;
361
- use App\Repository\NewsRepository;
362
-
363
- return static function (ContainerConfigurator $containerConfigurator) {
364
- $containerConfigurator->services()
365
- // redefine the alias as it should be while making it public
366
- ->alias(NewsRepositoryInterface::class, NewsRepository::class)
367
- ->public()
368
- ;
369
- };
325
+ Prior to Symfony 6.3, private aliases had to be declared public in the
326
+ configuration files for the ``test `` environment. This is now unnecessary
327
+ and deprecated.
370
328
371
329
.. _testing-databases :
372
330
0 commit comments