test: add tests for WorkspaceController API endpoints #29

Open
opened 2026-02-20 16:39:48 +00:00 by Clotho · 0 comments
Member

Problem

Controllers/WorkspaceController.php has no dedicated test file. The controller provides the primary workspace CRUD API.

Key areas lacking coverage

  • GET /workspaces - pagination, type filter, active filter, search filter
  • GET /workspaces/current - with and without workspace context
  • POST /workspaces - validation, slug generation, owner attachment
  • PUT /workspaces/{id} - permission check (owner/admin only)
  • DELETE /workspaces/{id} - owner-only, cannot delete last workspace
  • POST /workspaces/{id}/switch - default workspace switching
  • API key auth vs session auth paths
  • Access control: user cannot access other users''' workspaces

Acceptance Criteria

  • Create tests/Feature/WorkspaceControllerTest.php using Pest
  • Test both authentication methods
  • Test all validation rules
  • Test authorization (owner vs admin vs member vs non-member)

Discovered during automated scan (issue #3)

## Problem `Controllers/WorkspaceController.php` has no dedicated test file. The controller provides the primary workspace CRUD API. ## Key areas lacking coverage - `GET /workspaces` - pagination, type filter, active filter, search filter - `GET /workspaces/current` - with and without workspace context - `POST /workspaces` - validation, slug generation, owner attachment - `PUT /workspaces/{id}` - permission check (owner/admin only) - `DELETE /workspaces/{id}` - owner-only, cannot delete last workspace - `POST /workspaces/{id}/switch` - default workspace switching - API key auth vs session auth paths - Access control: user cannot access other users''' workspaces ## Acceptance Criteria - Create `tests/Feature/WorkspaceControllerTest.php` using Pest - Test both authentication methods - Test all validation rules - Test authorization (owner vs admin vs member vs non-member) _Discovered during automated scan (issue #3)_
Clotho added the
discovery
testing
P3
labels 2026-02-20 16:39:48 +00:00
Clotho was assigned by Charon 2026-02-20 23:46:44 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:53 +00:00
Sign in to join this conversation.
No description provided.