Table of Contents
tests/api/unit/PostsApiControllerTest.php
Source: tests/api/unit/PostsApiControllerTest.php · 299 lines, ~1346 statements · namespace: (global) · `declare(strict_types=1)`: no
PostsApiController Test
Unit tests for Scriptlog\Controller\Api\PostsApiController 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: the controller is public for GET actions (requiresAuth=false at construction) but write actions re-enable requiresAuth and enforce permissions via ApiAuth::hasPermission(). The fixture's API key (administrator) is supplied for all write assertions.
Note: the Location header set by ApiResponse::created() is not observable through the runner because headers_list() is empty in CLI mode; the 201 + Location pair is asserted at the HTTP level by the integration suite.
Includes
| Mode | Target | Line |
|---|---|---|
require | require_once DIR . '/../ApiTestCase.php'; | 22 |
require | require_once DIR . '/../fixtures/ApiDataFixture.php'; | 23 |
