symfony - AutoWire services_test.yaml -> 没有 ID 为“service.a”的节点
问题描述
在 SF4.2 正常路线中迁移到 AutoWire 后,单元测试无法正常工作。
服务.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 定义/重载
运行,任何测试,它在(WebTestCase)失败:
$client = static::createClient();
InvalidArgumentException: There is no node with id "service.a".
当我复制 to 的定义时service.a
-services_test.yaml
它有效。但是我想要并且必须避免两次定义所有服务(为错误引入了巨大的表面)
解决方案
看起来像一个错误 - 应该由https://github.com/symfony/symfony/pull/29393修复
推荐阅读
- groovy - 在 ReadyApi 中删除 groovy 中的最后零位
- java - 二进制搜索中是否需要维护高变量和低变量?
- android - OnMarkerClickListener 在 Kotlin 片段中不起作用
- xpath - 如何获取输入标签中属性的内容?
- r - ggplot2:手动同时分配不同大小的文字和线条的粗细?
- javascript - 在移动设备和桌面设备上加载不同的元素或背景图像
- excel - 索引匹配双重标准不起作用,是什么问题?
- python - 从 2D 矩阵中移除角点
- r - 更改 geom_tile() 热图上的中断
- tomcat - 找不到tomcat运行时错误tomcat-user.xml