阅读(152) (11)

Laravel 8 调试响应

2021-07-08 09:45:49 更新

测试请求通过应用程序后,dumpdumpHeadersdumpSession 方法可以用来分析和调试响应:

<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;

class ExampleTest extends TestCase
{
    /**
     * 一个基础的测试实例
     *
     * @return void
     */
    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->dumpHeaders();

        $response->dumpSession();

        $response->dump();
    }
}