我正在使用Vagrant创建的VM内的Drupal 7多站点安装。我正在使用Jenkins在此环境中的一些站点上运行Simpletests。
这些测试的输出以JUnit XML格式提供,并且由Jenkins读取。我遇到的问题是输出包含一些与测试结果无关的php警告,但是由于这些警告,该测试被标记为失败。
通知示例:
`exception: [Notice] Array to string conversion [theme.inc:129]`
以上“通知”被标记为测试失败。
我想禁止显示这些警告和通知,因此测试仅在出现错误或实际失败的测试时失败。
这里是一个测试的完整输出:
Error Message
Number of unexpected errors: 2
Stacktrace
exception: [Notice] Array to string conversion [theme.inc:129]
exception: [Notice] Array to string conversion [theme.inc:129]
Standard Output
exception: [Notice] Array to string conversion [theme.inc:129]
exception: [Notice] Array to string conversion [theme.inc:129]
我能够通过添加以下内容来禁止显示这些警告和通知:error_reporting(0);
在全局设置文件的顶部。所有测试都通过!