【发布时间】:2021-07-04 08:09:30
【问题描述】:
这是我为类别测试创建的测试用例。当我正确配置租户测试用例并且此路由存在于在 chrome 浏览器上创建的子域上时,我在此路由上得到 404。
public function test_example()
{
$response = $this->call('GET', '/categories/6/edit');
$this->assertEquals(200, $response->getStatusCode(),$response->exception->getMessage());
}
我的TestCase.php
protected $tenancy = false;
public function setUp(): void
{
parent::setUp();
if ($this->tenancy) {
$this->initializeTenancy();
}
}
public function initializeTenancy()
{
$tenant = Tenant::create();
tenancy()->initialize($tenant);
}
我正在关注的文档 https://tenancyforlaravel.com/docs/v3/testing
结果: 我想要 302 响应意味着重定向到登录代码。
【问题讨论】:
标签: php laravel multi-tenant multi-database