test: add tests for API resource transformers #10

Open
opened 2026-02-20 03:14:46 +00:00 by Clotho · 0 comments
Member

Missing Test Coverage

Files:

  • src/Api/Resources/ApiKeyResource.php
  • src/Api/Resources/WebhookEndpointResource.php
  • src/Api/Resources/WorkspaceResource.php
  • src/Api/Resources/ErrorResource.php
  • src/Api/Resources/PaginatedCollection.php

What Needs Testing

  • Resource transformation to JSON structure
  • Hidden/masked fields (e.g., API key hashes)
  • Relationship loading and nesting
  • Pagination metadata in PaginatedCollection
  • Null value handling
  • Resource collections vs single resources

Implementation Notes

Create src/Api/Tests/Feature/ApiResourceTest.php:

  • Test each resource class output structure
  • Verify sensitive data is masked (api key prefixes, hashes)
  • Test PaginatedCollection includes meta/links
  • Verify ErrorResource format matches OpenAPI spec

Priority

Medium - Resources define public API contract

## Missing Test Coverage **Files**: - `src/Api/Resources/ApiKeyResource.php` - `src/Api/Resources/WebhookEndpointResource.php` - `src/Api/Resources/WorkspaceResource.php` - `src/Api/Resources/ErrorResource.php` - `src/Api/Resources/PaginatedCollection.php` ### What Needs Testing - Resource transformation to JSON structure - Hidden/masked fields (e.g., API key hashes) - Relationship loading and nesting - Pagination metadata in PaginatedCollection - Null value handling - Resource collections vs single resources ### Implementation Notes Create `src/Api/Tests/Feature/ApiResourceTest.php`: - Test each resource class output structure - Verify sensitive data is masked (api key prefixes, hashes) - Test PaginatedCollection includes meta/links - Verify ErrorResource format matches OpenAPI spec ### Priority Medium - Resources define public API contract
Clotho added the
discovery
label 2026-02-20 03:14:46 +00:00
Charon added
PHP
testing
P2
and removed
discovery
labels 2026-02-20 12:17:08 +00:00
Clotho was assigned by Charon 2026-02-20 12:21:03 +00:00
Charon added the
agent-ready
label 2026-02-21 01:30:30 +00:00
Sign in to join this conversation.
No description provided.