Commit 8d7fe26
committed
Tests: Add PHPUnit tests for REST API classes
Add comprehensive tests for the REST API integration:
- test-acf-rest-api.php: Tests for ACF_Rest_Api class including
initialization, schema generation, field loading, and filtering
- test-acf-rest-api-functions.php: Tests for helper functions like
acf_get_field_rest_schema() and acf_format_value_for_rest()
- test-acf-rest-embed-links.php: Tests for ACF_Rest_Embed_Links class
covering link preparation and response integration
- test-acf-rest-request.php: Tests for ACF_Rest_Request class
including request parsing and URL parameter handling
Test coverage includes:
- REST API initialization and configuration
- Schema generation and structure validation
- Field loading with show_in_rest filtering
- Request parsing and object type detection
- Embed link preparation and loading
- Filter hook integration (acf/rest/* hooks)
- Admin mode detection
- REST API format settings (light/standard)
- Error handling and edge cases
143 tests with 200 assertions. Some tests are skipped in WorDBless
environment due to field type and location type registration limitations.1 parent fba4d95 commit 8d7fe26
File tree
4 files changed
+2928
-0
lines changed- tests/php/includes/rest-api
4 files changed
+2928
-0
lines changed
0 commit comments