1

これは、カテゴリ テスト用に作成したテスト ケースです。テナント テスト ケースを正しく構成しているのに、このルートで 404 を取得しています。このルートは、Chrome ブラウザで作成されたサブドメインに存在します。

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 応答が必要です。これは、ログイン コードにリダイレクトすることを意味します。

4

1 に答える 1