Files
TheWitness b349b8f306 ci: add CodeQL workflow and adopt DbFunctionsTest/OutputEscapingTest from #229 (#238)
Cherry-picked from Cacti/plugin_monitor#229 (somethingwithproof:hardening/testing-and-workflows) and adapted to this repo's existing Pest setup:

- .github/workflows/codeql.yml: added as-is (JS/TS CodeQL scanning).
- tests/Integration/OutputEscapingTest.php: added as-is, references tests/Unit instead of tests/unit in its docblock.
- tests/Unit/DbFunctionsTest.php: added, placed under tests/Unit (PascalCase) instead of tests/unit to match this repo's layout.
- tests/bootstrap-unit.php: get_request_var()/get_nfilter_request_var()/get_filter_request_var()/set_request_var() now read/write a stubbed \['__test_request'] store, and a new test_set_request() helper lets tests control request vars, mirroring #229's tests/bootstrap.php.
- tests/Pest.php: added a beforeEach() hook resetting __test_db_calls and the request var store between tests.
2026-09-15 15:37:04 -04:00

20 lines
755 B
PHP

<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
*/
/*
* Pest configuration file. The bootstrap is loaded via phpunit.xml's
* bootstrap attribute (tests/bootstrap-unit.php), which requires Cacti's
* own Composer-managed vendor tree checked out by the CI workflow.
*/
uses()->beforeEach(function () {
$GLOBALS['__test_db_calls'] = array();
test_set_request(array());
})->in(__DIR__);