test: add tests for NamespaceService #30

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

Problem

Services/NamespaceService.php has no dedicated test file. The service handles namespace resolution, session management, and access control.

Key areas lacking coverage

  • current() resolution priority (request attribute → session → user default)
  • findByUuid() with cache hit and miss
  • defaultForUser() priority chain (explicit default → first owned → workspace namespace)
  • accessibleByUser() caching behaviour
  • groupedForUser() structure and N+1 fix verification
  • canAccess() access control
  • Cache invalidation methods

Acceptance Criteria

  • Create tests/Feature/NamespaceServiceTest.php using Pest
  • Test the full resolution priority chain
  • Test cache hit/miss behaviour
  • Test access control correctly denies unauthorised access

Discovered during automated scan (issue #3)

## Problem `Services/NamespaceService.php` has no dedicated test file. The service handles namespace resolution, session management, and access control. ## Key areas lacking coverage - `current()` resolution priority (request attribute → session → user default) - `findByUuid()` with cache hit and miss - `defaultForUser()` priority chain (explicit default → first owned → workspace namespace) - `accessibleByUser()` caching behaviour - `groupedForUser()` structure and N+1 fix verification - `canAccess()` access control - Cache invalidation methods ## Acceptance Criteria - Create `tests/Feature/NamespaceServiceTest.php` using Pest - Test the full resolution priority chain - Test cache hit/miss behaviour - Test access control correctly denies unauthorised access _Discovered during automated scan (issue #3)_
Clotho added the
discovery
testing
P3
labels 2026-02-20 16:39:50 +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:52 +00:00
Sign in to join this conversation.
No description provided.