Tenant Multi tenancy Laravel Unit Testing issue

  laravel, multi-database, multi-tenant, php

Here is the test case that i created for category testing. I am getting 404 on this route while i have correctly configured the tenant test case and this route is exist on subdomain that was created on chrome browser.

public function test_example()
    $response = $this->call('GET', '/categories/6/edit');
    $this->assertEquals(200, $response->getStatusCode(),$response->exception->getMessage());

My TestCase.php

  protected $tenancy = false;

public function setUp(): void
    if ($this->tenancy) {

public function initializeTenancy()
    $tenant = Tenant::create();

Documentation I am following

I want 302 response means redirect to login code.

Source: Laravel

Leave a Reply