Testing with stancl/tenancy

I'm trying to test A resource page, and I'm getting the error in the screenshot, I'm using stancl/tenancy package and I have the tenancy initialization in the Base TestCase file, anyhelp?
<?php

namespace Tests\Feature\Filament\Resources;

use App\Filament\Resources\DomainResource;
use App\Filament\Resources\DomainResource\Pages\ListDomains;
use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Livewire\Livewire;
use App\Models\Domain;
use App\Models\Tenant;
use Tests\TestCase;

class DomainResourceTest extends TestCase
{
    use DatabaseMigrations, RefreshDatabase, WithFaker;

    public function setUp(): void
    {
        parent::setUp();

        $user = User::factory()->create();
        $user->permissions()->create(['name' => 'domains.viewAny']);
        $this->actingAs($user);
    }
 
    public function test_render_page()
    {
        $this->get(DomainResource::getUrl('index'))->assertSuccessful();
    }

    public function test_list_domains()
    {
        $tenant = Tenant::factory()->create();
        $domains = Domain::factory()->count(10)->create([
            'tenant_id' => $tenant->id,
        ]);
 
        Livewire::test(ListDomains::class)
            ->assertCanSeeTableRecords($domains);
    }
}
image.png
Was this page helpful?