Testing relation manager (that is a nested resource)

What I am trying to do: I'm trying to write a test for the relation manager of a resource that is nested. (One project has many assignments). What I did: I wrote a test according to the documentation. The tests with relation managers but that are not a nested resource do pass. My issue/the error:
Missing required parameter for [Route: filament.app.ppm.resources.projects.assignments.view] [URI: ppm/projects/{project}/assignments/{record}] [Missing parameter: project].
Missing required parameter for [Route: filament.app.ppm.resources.projects.assignments.view] [URI: ppm/projects/{project}/assignments/{record}] [Missing parameter: project].
Code:
it('can redirect to view assignment page', function () {
$user = createUserWithPermissions(['view projects', 'update projects', 'view assignments', 'create assignments']);
actingAs($user);

$project = Project::factory()->hasAssignments(2)->create();

livewire(AssignmentsRelationManager::class, [
'ownerRecord' => $project,
'pageClass' => ViewProject::class,
])
->assertOk()
->assertCanSeeTableRecords($project->assignments);
});
it('can redirect to view assignment page', function () {
$user = createUserWithPermissions(['view projects', 'update projects', 'view assignments', 'create assignments']);
actingAs($user);

$project = Project::factory()->hasAssignments(2)->create();

livewire(AssignmentsRelationManager::class, [
'ownerRecord' => $project,
'pageClass' => ViewProject::class,
])
->assertOk()
->assertCanSeeTableRecords($project->assignments);
});
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?