Laravel 8 调试响应
测试请求通过应用程序后,dump
,dumpHeaders
和 dumpSession
方法可以用来分析和调试响应:
<?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();
}
}