test: add tests for WorkspaceController API endpoints #83

Open
Charon wants to merge 2 commits from feat/test-workspace-controller into dev
Member

Summary

  • Add comprehensive feature test file WorkspaceControllerTest.php with 46 tests (97 assertions)
  • Covers all WorkspaceController CRUD endpoints: index (pagination, filtering, search), store (create + owner attachment), show (access control), update (role-based permissions), destroy (ownership + single-workspace guard), and switch (hub-domain scoping, transaction atomicity)
  • Tests current workspace resolution with fallback behaviour
  • Includes edge cases: special characters, slug uniqueness, cascade deletes, boolean casts, settings JSON

Fixes #29

Test plan

  • All 46 tests pass locally (vendor/bin/pest tests/Feature/WorkspaceControllerTest.php)
  • Code formatted with Pint
  • CI pipeline passes
## Summary - Add comprehensive feature test file `WorkspaceControllerTest.php` with 46 tests (97 assertions) - Covers all WorkspaceController CRUD endpoints: index (pagination, filtering, search), store (create + owner attachment), show (access control), update (role-based permissions), destroy (ownership + single-workspace guard), and switch (hub-domain scoping, transaction atomicity) - Tests current workspace resolution with fallback behaviour - Includes edge cases: special characters, slug uniqueness, cascade deletes, boolean casts, settings JSON Fixes #29 ## Test plan - [x] All 46 tests pass locally (`vendor/bin/pest tests/Feature/WorkspaceControllerTest.php`) - [x] Code formatted with Pint - [ ] CI pipeline passes
Charon added 2 commits 2026-03-24 13:57:48 +00:00
Add @property, @property-read, @method, and @mixin PHPDoc annotations
to the seven core Eloquent models for IDE autocompletion support.

Models annotated:
- Workspace: all columns, relationships, scopes (active, ordered)
- User: all columns, relationships, factory
- WorkspaceMember: relationship props, scope methods (forWorkspace, forUser, withRole, inTeam, owners)
- WorkspaceInvitation: all columns, relationships, scopes (pending, expired, accepted)
- Namespace_: all columns, relationships, scopes (active, ordered, ownedByUser, ownedByWorkspace, accessibleBy)
- Package: all columns, relationships, scopes (active, public, base, addons, purchasable, free, ordered)
- Feature: all columns, relationships, scopes (active, inCategory, root)

Fixes #31

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add comprehensive feature tests for WorkspaceController covering all
CRUD operations and workspace switching logic. 46 tests with 97
assertions verify: listing with pagination/filtering/search, show with
access control, create with owner attachment, update with role-based
permissions (owner/admin/member/outsider), delete with ownership and
single-workspace guards, switch with hub-domain scoping and transaction
atomicity, and current workspace resolution with fallback.

Fixes #29

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/test-workspace-controller:feat/test-workspace-controller
git checkout feat/test-workspace-controller

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff feat/test-workspace-controller
git checkout feat/test-workspace-controller
git rebase dev
git checkout dev
git merge --ff-only feat/test-workspace-controller
git checkout feat/test-workspace-controller
git rebase dev
git checkout dev
git merge --no-ff feat/test-workspace-controller
git checkout dev
git merge --squash feat/test-workspace-controller
git checkout dev
git merge --ff-only feat/test-workspace-controller
git checkout dev
git merge feat/test-workspace-controller
git push origin dev
Sign in to join this conversation.
No description provided.