From 5ef8eb68b10ad9cfa5d99dd16b7cad155572dec0 Mon Sep 17 00:00:00 2001 From: "Beau Beauchamp, WebTigers" Date: Mon, 17 Aug 2026 07:05:32 -0400 Subject: [PATCH] Skills: opt the grid screen into the DataTables assets (fix empty grid) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Skills manager showed no data: the admin layout loads DataTables + tiger.datatable.js ONLY when a view sets $view->useDataTables (admin.phtml), and Agent_SkillsController::indexAction never set it. So tigerDataTable() was undefined on the page and the grid's init bailed silently — the server was returning a correct 129-row envelope the whole time. - Set $this->view->useDataTables = true in indexAction (matches every other datatable screen, e.g. Access user/org, Code). - SkillsControllerTest: assert the shell dispatches 200, sets its title, and opts into DataTables — the direct regression guard. Co-Authored-By: Claude Opus 4.8 --- .../agent/controllers/SkillsController.php | 3 +- .../Agent/SkillsControllerTest.php | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/Integration/Agent/SkillsControllerTest.php diff --git a/modules/agent/controllers/SkillsController.php b/modules/agent/controllers/SkillsController.php index d110afe..b899c5b 100644 --- a/modules/agent/controllers/SkillsController.php +++ b/modules/agent/controllers/SkillsController.php @@ -16,6 +16,7 @@ public function init() /** Render the Skills manager (search catalog + installed list). */ public function indexAction() { - $this->view->title = 'Agent Skills — Tiger Admin'; + $this->view->title = 'Agent Skills — Tiger Admin'; + $this->view->useDataTables = true; // opt into the DataTables + tiger.datatable.js assets (admin.phtml) } } diff --git a/tests/Integration/Agent/SkillsControllerTest.php b/tests/Integration/Agent/SkillsControllerTest.php new file mode 100644 index 0000000..b46772c --- /dev/null +++ b/tests/Integration/Agent/SkillsControllerTest.php @@ -0,0 +1,51 @@ +useDataTables the admin + * layout never loads tiger.datatable.js, so tigerDataTable() is undefined and the grid stays empty. This + * asserts that opt-in (the regression guard for exactly that "no data in the grid" bug). + */ +#[CoversClass(Agent_SkillsController::class)] +final class SkillsControllerTest extends ControllerTestCase +{ + private bool $priorUnitTestMode; + + protected function setUp(): void + { + parent::setUp(); + $this->priorUnitTestMode = Zend_Session::$_unitTestEnabled; + Zend_Session::$_unitTestEnabled = true; + $_SESSION = []; + } + + protected function tearDown(): void + { + $_SESSION = []; + Zend_Session::$_unitTestEnabled = $this->priorUnitTestMode; + parent::tearDown(); + } + + #[Test] + public function index_renders_the_shell_and_opts_into_datatables(): void + { + $this->loginAs('admin'); + $res = $this->dispatchAction(Agent_SkillsController::class, 'index', [], 'GET'); + $this->assertSame(200, $res->getHttpResponseCode()); + + $view = $this->controller()->view; + $this->assertSame('Agent Skills — Tiger Admin', $view->title); + $this->assertTrue($view->useDataTables, 'the grid needs the DataTables assets, or it renders empty'); + } +}