Laravel PHPUnit 返回 404
问题描述
对于 laravel API,我已经编写了测试用例.但是每当我运行测试用例时,它总是失败并出现以下错误,
将 $this->withoutExceptionHandling(); 添加到测试用例代码后,它会返回以下错误,
<块引用>
我在测试文件中的代码是,
我已经搜索了错误并尝试了许多解决方案但无法成功.任何人请告诉我是什么问题.
是404错误,所以没有找到你的网页:
不好的方式,发布到 /api/company 或使用 /index.php/api/company 但不是使用域名"!
如果它不起作用,请检查该 api 路由的路由配置.你的控制器和动作声明得好吗?
For laravel API I have write the test cases. But whenever I am running the test cases it always failed with below error,
After adding the $this->withoutExceptionHandling(); to testcase code it return the below error,
My Code in Test File is,
I have googled the error and tried many solutions but unable to succeed. Anyone please let me know whats the issue.
It is a 404 error, so your webpage is not found :
Bad way to go, post to /api/company or with /index.php/api/company but not with "domainname" !
If it is not working, check your route config for that api route. Are your controller and action declared well ?
这篇关于Laravel PHPUnit 返回 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
