Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 重定向后的Laravel断言状态_Php_Laravel - Fatal编程技术网

Php 重定向后的Laravel断言状态

Php 重定向后的Laravel断言状态,php,laravel,Php,Laravel,我正在尝试测试一个简单的控制器: public function testCreatePlace() { $response = $this->json('post','/create/place', [ 'name' => 'Testburg', 'description' => 'Hauptstadt Testlands' ]); $response->assertStatus(200); } 但问题是,我的

我正在尝试测试一个简单的控制器:

public function testCreatePlace()
{
    $response = $this->json('post','/create/place', [
        'name' => 'Testburg',
        'description' => 'Hauptstadt Testlands'
    ]);

    $response->assertStatus(200);
}

但问题是,我的中间件将用户重定向到具有特定语言版本的子域(例如,
de.mywebsite.vagrant
)。因此,当我运行测试时,它会获得第一个状态302,并立即中断。我如何在重定向后断言请求,resp。获取结束响应状态?

您可以随时禁用中间件。Laravel为每个测试端提供了withoutMiddleware特性注意:我相信您的状态代码需要是
201
,因为这是一个创建操作