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'); + } +}