在 PhpStorm 2016.1 上使用 Laravel / Homestead 启用 PHPUnit 以
Posted
技术标签:
【中文标题】在 PhpStorm 2016.1 上使用 Laravel / Homestead 启用 PHPUnit 以【英文标题】:Enable PHPUnit with Laravel / Homestead on PhpStorm 2016.1 to 【发布时间】:2016-09-09 22:32:06 【问题描述】:我正在研究 vagrant / homestead,并配置了一个盒子。
我可以在 phpStorm 中启用 Xdebug!
现在,我想启用 PHPUnit,但我做不到...
我遵循了几个教程: https://blog.mayflower.de/5274-Run-your-tests-with-PHPStorm-on-your-vagrant-box.html https://confluence.jetbrains.com/display/PhpStorm/Running+PHPUnit+tests+over+SSH+on+a+remote+server+with+PhpStorm 这是我的设置:
这是我在使用代码覆盖率运行 PhpUnit 时收到的消息
vagrant:///Users/julien/Homestead/usr/bin/php -dxdebug.coverage_enable=1 /home/vagrant/.phpstorm_helpers/phpunit.php --coverage-clover /home/vagrant/.phpstorm_helpers/coverage/Laravel_PhpUnit.coverage -- configuration /home/vagrant/Code/vendor/autoload.php /Users/julien/Documents/Proyectos/laravel/tests/functional
Testing started at 11:12 AM ...
bash: line 0: cd: /Users/julien/Documents/Proyectos/laravel/tests/functional: No such file or directory
PHP Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php:181
Stack trace:
Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181#0 /home/vagrant/.phpstorm_helpers/phpunit.php(181): Phar- >__construct('/home/vagrant/C...')
#1 /home/vagrant/.phpstorm_helpers/phpunit.php(250): IDE_PHPUnit_Loader::init()
#2 main
UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
thrown in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
Call Stack:
0.0006 442920 1. main() /home/vagrant/.phpstorm_helpers/phpunit.php:0
0.0006 442920 2. IDE_PHPUnit_Loader::init() /home/vagrant/.phpstorm_helpers/phpunit.php:250
0.0006 451168 3. Phar->__construct() /home/vagrant/.phpstorm_helpers/phpunit.php:181
Process finished with exit code 255
【问题讨论】:
【参考方案1】:使用 PhpStorm 和 PHPUnit 设置 vagrant 可能有点令人生畏,因为它真的不是那么简单......从你的控制台输出我会说你的解释器设置不正确,因为它在你的本地机器上执行 PHP .
一直对我有用的方法是将 vagrant 设置为 SFTP 部署配置并将该配置用作 PHP 解释器。由于您已经在使用 Homesteasd,这些教程可能会为您的设置提供更多启示:
Setting up PhpStorm with Vagrant on a Laravel Homestead box Setting up Laravel with PHPUnit on Vagrant in PhpStorm以下是基本部分:
【讨论】:
以上是关于在 PhpStorm 2016.1 上使用 Laravel / Homestead 启用 PHPUnit 以的主要内容,如果未能解决你的问题,请参考以下文章
angular 2 种子,webstorm 2016.1 突然停止导入库