【问题标题】:PHPunit not working in 'artisan tinker' in LaravelPHPunit 在 Laravel 的“工匠修补匠”中不起作用
【发布时间】:2019-03-05 04:21:48
【问题描述】:

我正在 a tutorial on Laracast 学习 Laravel。现在我有点卡在一个我不想跳过的部分(前 40 秒)。

问题是当我打开 PHP artisan tinker 并执行以下命令时:phpunit (or vendor/bin/phpunit) 它给了我错误:

PHP Notice:  Use of undefined constant phpunit - assumed 'phpunit' in /var/www/vhosts/web-wings.nl/roylar.web-wings.nleval()'d code on line 1

PHP Notice:  Use of undefined constant vendor - assumed 'vendor' in /var/www/vhosts/web-wings.nl/roylar.web-wings.nleval()'d code on line 1

当我尝试时

phpunit tests/Unit/ExampleTest.php 

它给出了错误:

PHP 解析错误:语法错误,第 1 行出现意外的 T_STRING

所以phpunit肯定有问题,但我找不到答案。我查看了教程的 cmets、Youtube 和 Google,但没有。

【问题讨论】:

    标签: php laravel phpunit


    【解决方案1】:

    没有使用php artisan tinker 测试的phpunit 没有问题 因为 tinker 命令使用 PsySH 库在 Laravel 应用程序的上下文中设置 REPL (read-eval print loop) 环境

    【讨论】:

      猜你喜欢
      • 2018-06-26
      • 2023-03-17
      • 2017-11-12
      • 2017-05-26
      • 2013-09-25
      • 2015-09-24
      • 2017-08-25
      • 2014-03-19
      • 2016-04-16
      相关资源
      最近更新 更多