create(); $workspace = Workspace::factory()->create(['name' => 'Northwind Workspace']); WorkspaceMembership::factory()->create([ 'workspace_id' => (int) $workspace->getKey(), 'user_id' => (int) $user->getKey(), 'role' => 'readonly', ]); $this->actingAs($user) ->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()]) ->get('/admin') ->assertOk() ->assertSee('Workspace overview') ->assertSee('Northwind Workspace'); });