Laravel 5:PHPunit无法启动,抛出内部服务器错误

时间:2016-10-13 13:32:12

标签: html phpunit laravel-5.2 internal-server-error

我刚刚为我实施的新控制器编写测试,并希望运行它们但是phpunit给了我以下错误...我正在运行laravel 5.2。我想知道你们中是否有人知道它可能来自哪里?

提前感谢您的帮助:)

马丁

$ phpunit
PHPUnit 5.6.1 by Sebastian Bergmann and contributors.

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Internal Server Error</title>

<style type="text/css">
/*<![CDATA[*/
body {font-family:"Verdana";font-weight:normal;color:black;background-color:white;}
h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
/*]]>*/
</style>
</head>

<body>
<h1>Internal Server Error</h1>
<h2>include(DB.php): failed to open stream: No such file or directory</h2>
<p>
An internal error occurred while the Web server was processing your request.
Please contact the webmaster to report this problem.
</p>
<p>
Thank you.
</p>
<div class="version">
2016-10-13 13:27:21 </div>
</body>

2 个答案:

答案 0 :(得分:0)

您的测试结果如何?何时出现此错误?您是否尝试过仅运行特定测试,例如:

phpunit tests/someTest.php

常规故障排除:

尝试运行

composer dump-autoload

紧接着:

composer install

此外,除非您拥有全局,否则请为phpunit设置别名

从项目根目录尝试以下命令:

./vendor/bin/phpunit 

您还可以添加is as as:

alias phpunit="/{pathtoproject}/vendor/bin/phpunit"

最后但并非最不重要的是,您可以尝试使用.bash_profile:

export PATH=$PATH:~/.composer/vendor/bin

答案 1 :(得分:-1)

我们删除了Yii,制作了我们自己的基于角色的系统,现在PHPunit启动了!我们得到了另一个错误,但没有任何相关问题,感谢您的帮助:)