【问题标题】:Running tests in PhpStorm for Laravel Homestead vagrant VM在 PhpStorm 中为 Laravel Homestead vagrant VM 运行测试
【发布时间】:2016-10-12 00:51:32
【问题描述】:

我基于此安装了全新的 Laravel Homestead:https://laravel.com/docs/master/homestead

还有一个使用 Laravel new 的全新项目。

我正在尝试通过 PhpStorm 的“运行配置”运行示例测试,但我得到了

vagrant:///Users/si/vagrant/Homestead/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --no-configuration /home/vagrant/Code/homestead/tests
Testing started at 00:49 ...

Process finished with exit code 1
Cannot find PHPUnit in include path (.:/usr/share/php)

在 PhpStorm PHPUnit 设置中,我将 PHPUnit 库加载为“使用自定义自动加载器”,指向 composer autoload.php 文件,如下所示:

/Users/si/Code/homestead/vendor/autoload.php

composer 已经在

处添加了 PHPUnit 可执行文件
/Users/si/Code/homestead/vendor/bin/phpunit

当我告诉 PhpStorm 使用 Composer 自动加载来查找它时,为什么找不到这个 PHPUnit 可执行文件,我对此感到困惑。

【问题讨论】:

  • 你配置远程php解释器了吗?
  • 是的 - 这一切看起来都不错,尽管我没有为包含路径添加任何明确的内容。

标签: laravel phpunit phpstorm homestead


【解决方案1】:

好的,我解决了这个问题。我在 PHP 设置中添加了一个远程解释器,但仍在 PHPUnit 设置中使用“本地”设置。我在 Languages and Framdworks > PHP > PHPUnit settings 屏幕中添加了一个新的 PHPUnit 设置配置“通过远程解释器”。

我选择了“使用自定义自动加载器”并指定了以下内容:

/home/vagrant/Code/homestead/vendor/autoload.php

【讨论】:

    猜你喜欢
    • 2021-02-24
    • 2015-02-27
    • 2017-05-05
    • 2016-07-06
    • 2018-11-09
    • 2017-04-18
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多