AutoWire services_test.yaml -> 没有 ID 为 'service.a' 的节点

AutoWire services_test.yaml -> There is no node with id 'service.a'

迁移到 SF4.2 中的 AutoWire 后无法进行单元测试 正常路线工作正常。

services.yaml:

services:
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        public: false       # Allows optimizing the container by removing unused services; this also means

# enable AW on controllers
    KRNApiBundle\Controller\:
        resource: '../../Controller'
        tags: ['controller.service_arguments']

# AutoWireAliases
    MyClass: '@service.a'

    service.a:
      class: MyClass

services_test.yaml,有一些,但没有service.a defined/overloaded

运行,任何测试,在 (WebTestCase):

失败

$client = static::createClient();

InvalidArgumentException: There is no node with id "service.a".

当我将 service.a 的定义复制到 services_test.yaml 时 - 它有效。 但是我想要,并且必须避免,两次定义所有服务(引入大量错误)

在找到仍然使用 ->get() 的控制器和服务后,它以某种方式自行解决了这个问题。

看起来像是一个错误 - 应该由 https://github.com/symfony/symfony/pull/29393

修复