FilamentF
Filament3y ago
ana

Error running tests: Call to a member function getId() on null

laravel v10
filament v3
pest

project was updated from L9 and F2


One of the test that fails with that message: Tests\Feature\Back\Files\CreateTest.php
<?php

use App\Filament\Resources\FileResource;
use function Pest\Livewire\livewire;
use App\Models\User;
use App\Models\File;

it('redirects to login for guest', function () {
    test()->get(FileResource::getUrl('create'))
        ->assertStatus(302)
        ->assertRedirect(route('filament.auth.login'));
});



tests\TestCase.php
<?php

namespace Tests;

use App\Providers\Filament\AppPanelProvider;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;
    use LazilyRefreshDatabase;

}


Thank you
Solution
so i had an error that the login route is not refined (both 'filament.admin.auth.login' or 'filament.auth.login'). and it is not listed in route:list . To login i'm directed to the old application login.
I need to do a bit digging first, try and setup the regular filament login. and then see if this issue was fixed.
thank you for the help!
Was this page helpful?