关于如何使用behat和symfony2,我已经关注official docs。
但是当我运行命令
时$ php bin/behat --init "@FootprintsRestBundle"
features
目录在根目录中而不是在bundle内创建
声音与this issue类似,所以我尝试手动指定behat.yml
的路径,但结果相同。
我尝试将behat.yml
移动到app / config,然后运行
$ php bin/behat -c app/config/behat.yml --init "@FootprintsRestBundle"
在app / config中创建了 features
。
我尝试过的其他方法是使用phar扩展但出现致命错误
$ php behat.phar --init "@FootprintsRestBundle"
PHP Fatal error: Call to undefined method Composer\Autoload\ClassLoader::setPsr4() in /home/vagrant/footprints/vendor/composer/autoload_real.php on line 36
PHP Stack trace:
PHP 1. {main}() /home/vagrant/footprints/behat.phar:0
PHP 2. Symfony\Component\Console\Application->run() /home/vagrant/footprints/behat.phar:26
PHP 3. Behat\Behat\Console\BehatApplication->doRun() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:106
PHP 4. Behat\Behat\Console\BehatApplication->createCommand() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:66
PHP 5. Behat\Behat\Console\BehatApplication->createContainer() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:80
PHP 6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:94
PHP 7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:553
PHP 8. Behat\Symfony2Extension\Compiler\KernelInitializationPass->process() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php:119
PHP 9. require_once() phar:///home/vagrant/footprints/symfony2_extension.phar/src/Behat/Symfony2Extension/Compiler/KernelInitializationPass.php:42
PHP 10. require() /home/vagrant/footprints/app/autoload.php:9
PHP 11. ComposerAutoloaderInit0c3e5b20fed9b462369cb56a81ea018b::getLoader() /home/vagrant/footprints/vendor/autoload.php:7
Fatal error: Call to undefined method Composer\Autoload\ClassLoader::setPsr4() in /home/vagrant/footprints/vendor/composer/autoload_real.php on line 36
Call Stack:
0.0126 533576 1. {main}() /home/vagrant/footprints/behat.phar:0
0.0217 1426648 2. Symfony\Component\Console\Application->run() /home/vagrant/footprints/behat.phar:26
0.0263 1743184 3. Behat\Behat\Console\BehatApplication->doRun() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:106
0.0263 1743232 4. Behat\Behat\Console\BehatApplication->createCommand() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:66
0.0263 1743304 5. Behat\Behat\Console\BehatApplication->createContainer() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:80
0.0769 4302288 6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() phar:///home/vagrant/footprints/behat.phar/src/Behat/Behat/Console/BehatApplication.php:94
0.0781 4308960 7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php:553
0.0787 4312008 8. Behat\Symfony2Extension\Compiler\KernelInitializationPass->process() phar:///home/vagrant/footprints/behat.phar/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php:119
0.0794 4314440 9. require_once('/home/vagrant/footprints/app/autoload.php') phar:///home/vagrant/footprints/symfony2_extension.phar/src/Behat/Symfony2Extension/Compiler/KernelInitializationPass.php:42
0.0800 4316112 10. require('/home/vagrant/footprints/vendor/autoload.php') /home/vagrant/footprints/app/autoload.php:9
0.0806 4328488 11. ComposerAutoloaderInit0c3e5b20fed9b462369cb56a81ea018b::getLoader() /home/vagrant/footprints/vendor/autoload.php:7