Table of Contents
tests/api/unit/GdprApiControllerTest.php
Source: tests/api/unit/GdprApiControllerTest.php · 176 lines, ~684 statements · namespace: (global) · `declare(strict_types=1)`: no
GdprApiController Test
Unit tests for Scriptlog\Controller\Api\GdprApiController driven through the subprocess runner (ApiTestCase::runController). Controller actions terminate the process via ApiResponse::send(), so each action runs in an isolated PHP process against the seeded test database.
Auth: GDPR endpoints are public (requiresAuth=false at construction).
Implementation notes (deviations from the plan table): consent() returns 200 (not 201), validates the “status” field rather than an email address and answers 400 INVALID_STATUS (not 422) for bad input, and getConsentStatus() always returns 200 with a consent_given boolean (there is no 404 path). The fixture truncates tbl_consents so the status is deterministic per test.
Includes
| Mode | Target | Line |
|---|---|---|
require | require_once DIR . '/../ApiTestCase.php'; | 22 |
require | require_once DIR . '/../fixtures/ApiDataFixture.php'; | 23 |
