我正在尝试为我的 Laravel 7 应用程序编写一些测试。但我一直面临A facade root has not been set.
错误。
<?php
namespace Tests\Feature;
use Illuminate\Support\Facades\Config;
use PHPUnit\Framework\TestCase;
class AddressListenerRepositoryTest extends TestCase
{
public function testCreate()
{
Config::set('x', 'address_listeners'); // Cause of "A facade root has not been set" error
}
}
任何人都可以解释这个错误的原因吗?