我有一个遗留的 Symfony 2.0 项目(准确地说是 2.0.11 版),我想在其中添加行为测试。由于它是 Symfony 2.0,它使用deps
供应商系统而不是作曲家。我目前无法升级 Symfony 版本或切换到 composer。
我尝试使用以下 deps 设置安装 behat:
[Mink]
target=/Behat/Mink
git=git://github.com/Behat/Mink.git
version=v1.3.3
[MinkBundle]
target=/Behat/MinkBundle
git=git://github.com/Behat/MinkBundle.git
[BehatBundle]
target=/Behat/BehatBundle
git=git://github.com/Behat/BehatBundle.git
[Gherkin]
target=/Behat/Gherkin
git=git://github.com/Behat/Gherkin.git
version=v2.1.1
[Behat]
target=/Behat/Behat
git=git://github.com/Behat/Behat.git
version=v2.3.5
[Goutte]
target=/Goutte
git=git://github.com/fabpot/Goutte.git
(是的,我知道 BehatBundle 等已过时,但鉴于我使用的是 deps 和 sf2.0,我似乎需要这些过时的版本。)
当我运行时vendor/Behat/Behat/bin/behat
,我会得到这里描述的问题:
PHP Warning: require_once(behat/autoload.php): failed to open stream: No such file or directory in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
PHP Fatal error: require_once(): Failed opening required 'behat/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
我意识到 behat 2.3.5 实际上没有autoload.php
文件。我在 Github 上查看了 Behat 的标签,发现2.1.3是最新版本,它有一个autoload.php
(实际上autoload.php.dist
,虽然每个早期版本也有autoload.php.dist
而不是autoload.php
,所以我认为就是这样)。
因此,我将我的 behat 版本号更改deps
为v2.1.3
,删除了我的供应商并重新安装。然后 behat 命令发生了变化,所以我运行了:
php vendor/Behat/Behat/bin/behat.php
我现在看到了这个错误:
PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/src/Behat/Behat/Console/BehatApplication.php on line 26
有谁知道我应该使用什么正确版本的 behat 等来让它与 Symfony 2.0 和 deps 一起工作? 还是我缺少其他步骤。
PS 我最终通过 PHAR 运行 behat(尽管这有其他问题,所以我放弃了它,因为它不值得)。但是,我真的很想知道如何通过标准供应商安装来做到这一点,因此这篇文章。