Test infra: ControllerTestCase dispatch harness (unlocks controller coverage)#66
Merged
Conversation
…er coverage Covers the default-namespace controllers (core/controllers/*, 0% before) and any module controller WITHOUT booting the whole Tiger_Application. It configures a real front controller (core + module controller dirs, a view with the core script path + the Tiger view-helper prefix), instantiates a controller, and dispatches ONE action with view-rendering OFF — so the ACTION body runs (branch logic, view-var assignment, _json body, redirect/_forward decision) without needing the theme/layout/.phtml stack (view scripts aren't in the coverage source anyway). Assert on getBody()/echoed JSON, the redirect Location, the _forward target, or controller()->view. Extends IntegrationTestCase (DB + per-test transaction + login()/loginAs() + real ACL), and resets the front controller / layout / helper broker in tearDown so nothing leaks. The bootstrap autoloader now also resolves default-namespace *Controller classes from core/controllers. CoreControllerDispatchTest proves it against ApiController (echoed JSON + real gateway), AuthController (_json + 401), and IndexController. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WebTigers
added a commit
that referenced
this pull request
Jul 24, 2026
… 70.0%) (#67) Five parallel agents on the module + controller layer, collected + verified on one DB: ~167 tests, combined suite 1617 green. The unlock: a controller dispatch harness (ControllerTestCase, landed #66) that runs a controller action with view-rendering off — so core/controllers (0% before) and every module controller are now coverable. Results: core-controllers 0→87% (Api 80, Auth 79, Error 95, Index 87, Page 98, Admin 91), cms 33→94, code 41→90, agent module 6→66-78, system 37→59, + module controllers (profile 68, access 84, blog/media/analytics/identity/ signup/search/schedule 90-100%). REAL BUG FIXED (a test found it): Backup_IndexController::_json(int,string,array):string was an incompatible override of Tiger_Controller_Action::_json($data,$status) — a PHP 8.5 fatal at class load, so EVERY /backup request 500'd (the backup admin UI was broken). Renamed the helper to _jsonBody(); replaced the characterization test with real dispatch coverage. Harness hardening (3 agents independently hit it): folded redirector->setExit(false) into ControllerTestCase setUp (the redirector exits after headers → would kill the PHPUnit process on a controller redirect). CI floor MIN_COVERAGE 55 → 66. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A minimal ZF1 dispatch harness so the default-namespace controllers (
core/controllers/*, 0% covered) and module controllers can be tested without booting the wholeTiger_Application.How it works
ControllerTestCase(extendsIntegrationTestCase) configures a real front controller — core + module controller dirs, aZend_Viewwith the core script path + theTiger_View_Helperprefix — then instantiates a controller and dispatches one action with view-rendering OFF. The goal is controller-action coverage (branch logic, view-var assignment, the_jsonbody, the redirect /_forwarddecision), not.phtmloutput (view scripts aren't PHP classes and aren't in the coverage source). So it sidesteps the theme/layout/view-helper stack a full render needs, and you assert on what the action did:getBody()/ echoed JSON, the redirectLocation, the_forwardtarget, orcontroller()->view->*.Because it extends
IntegrationTestCase, the DB + per-test transaction +login()/loginAs()+ the real ACL are all there — a controller reads the auth identity and the shipped ACL exactly as in production.tearDownresets the front controller / layout / helper broker so nothing leaks across tests.The bootstrap autoloader now also resolves default-namespace
*Controllerclasses fromcore/controllers.Proof
CoreControllerDispatchTest(5) drives it against the real controllers:ApiController(captures the echoed JSON envelope from the real/apigateway + a deterministic guest denial),AuthController(_jsonbody + a 401 on bad credentials, the/auth/sessionheartbeat), andIndexController(a view-touching action dispatches cleanly with rendering off). Full combined suite stays green.This unblocks Wave 6 covering
core/controllers+ the module controllers.🤖 Generated with Claude Code