我需要根据配置使我的路线有条件:
//routes/auth.php
if (config('auth.allow_registration')) {....
上面的配置参数是在配置文件中设置的:
//config/auth.php
'allow_registration' => false,
一切正常,直到我尝试对其进行单元测试
public function test_registration_screen_can_be_rendered()
{
config()->set('auth.allow_registration', true);
$response = $this->get('/register');
$response->assertStatus(200);
}
测试用例失败。
我了解更改配置后,我需要重新读取路由。但是怎么做?
我发现只有这个$this->refreshApplication();
它应该重新读取路由,但它也会重新读取配置。
我怎样才能只重读路由,但保持修改后的配置完整?