如何修复 Class 'Behat\Behat\Output\Printer\ConsoleOutputPrinter' 未找到

How to fix Class 'Behat\Behat\Output\Printer\ConsoleOutputPrinter' not found

我正在尝试使用 PHPStorm 的 Behat 插件(在 Behat 3 上)。问题是,一旦我尝试 运行 一项功能,我将收到以下致命错误:

Fatal error:  Class 'Behat\Behat\Output\Printer\ConsoleOutputPrinter' not found in /private/var/folders/js/27x3tw5n5jx9b14vn_cn12w0748zmg/T/ide-behat.php on line 82

我查看了 Behat 源代码,我发现没有这样的文件,而是 "Behat\Behat\Output\Printer\ConsoleOutputFactory"

我确实尝试手动更改 "ide-behat.php" 中的代码,但作为你的 sson 运行 测试文件将自动重新生成

如有任何建议,我们将不胜感激。

谢谢

将"Behat"文件夹放在文件的同一文件夹中。

并尝试一次。

如果问题仍然存在,请告诉我

如 Behat 3 中所示。0.x-dev 输出打印机正在更改,ConsoleOutputPrinter 将其位置让给 ConsoleOutputFactory。

所以暂时我通过专门切换到 Behat 3.0.15 解决了我的问题。

例如通过将 composer.json 中的依赖项从

更改为
{
    "require": {
        "behat/behat": "3.0.x-dev"
    }
}

{
    "require": {
        "behat/behat": "3.0.15"
    }
}

但是了解更多关于 ide-behat.php 文件并理解修改它,为新 Behat 中即将发生的变化做好准备仍然很有趣。