繁体   English   中英

PHPUnit 测试 Laravel

[英]PHPUnit Testing Laravel

我无法在 PHPUnit 中找出这个。在 Postman 中它运行良好,但在 PHPUnit 中出现错误。

class MyPageTakumoiTest extends TestCase
{
    protected $api = "/api/my_page_takumoi/2";

    public function testUpdate()
    {

        $response = $this->json('PUT', $this->api, [
            'family_name' => 'new kk',
        ]);

        $response->assertStatus(200);

    }
}

Expected status code 200 but received 500.
Failed asserting that 200 is identical to 500.

在此处输入图像描述

您可以在测试开始时使用它来获得更好的异常:

$this->withoutExceptionHandling();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM