【发布时间】:2018-02-10 11:26:36
【问题描述】:
在我正在学习的一篇PHPUnit测试教程中,导师使用
$this->json('POST', "/images/{$image->id}/purchase", [
'email' => 'abc@gmail.com',
]);
当我尝试在我的测试中使用相同的代码来实现时,我得到了类似的异常错误
BadMethodCallException: 'json' 方法不存在。
C:\wamp64\www\RealTesting\vendor\laracasts\integrated\src\Extensions\IntegrationTrait.php:715
我在 Laravel 5.0 文档中搜索,找不到 json 函数。 我哪里做错了?有没有办法访问json函数?
编辑
在 Laravel 5.2 文档中,有一个 json function description on how to use
但是我找不到关于 Laravel 5.0 的 json 函数
【问题讨论】:
-
请您在此处添加您的代码/类,以便我们在正确的上下文中为您提供帮助。请edit 在此处添加有意义的代码和问题描述。发布 minimal reproducible example 来证明您的问题将帮助您获得更好的答案。谢谢!
标签: json unit-testing laravel-5