Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracoft's avatar
Level 27

PHP Fatal error: Access level to Pest\Concerns\Testable::setUp() must be public

<?php

namespace Tests\Feature;

use App\Filament\Resources\DeviceResource;
use App\Filament\Resources\DeviceResource\Pages\ListDevices;

use function Pest\Livewire\livewire;

beforeEach(function () {
    // seed();
    // $this->ownerUser = User::whereName('Owner')->first();
    // $this->doctorUser = User::whereName('Doctor')->first();
    // actingAs($this->ownerUser);
    // Storage::fake('avatars');
});

it('can render page', function () {
    $this->get(DeviceResource::getUrl('index'))->assertSuccessful();    
    livewire(ListDevices::class)
        ->assertForbidden();
});
PHP Fatal error:  Access level to Pest\Concerns\Testable::setUp() must be public

My above code keeps a PHP Fatal error which wants me to modify the access level of a file in a package. Any idea?

1 like
1 reply
niclm's avatar

Hi, I'm not sure if you fixed the issue but I ran into a similar issue:

Fatal error: Access level to Pest\Concerns\Testable::setUp() must be public (as in class Tests\TestCase)

the issue was in my TestCase.php , I was using the setUp :

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

I figured out that it needs to be protected function setUp() not public for it to work. Hope this helps!

Please or to participate in this conversation.