Repository navigation
test: add comprehensive FlowView test harness - #251
somethingwithproof wants to merge 10 commits into
Conversation
Add source-scan tests verifying security patterns (prepared statements, output escaping, auth guards, PHP 7.4 compatibility) remain in place across refactors. Tests run with Pest v1 (PHP 7.3+) and stub the Cacti framework so plugins can be tested in isolation. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a Pest v1-based test harness for the Flowview plugin, focused on static security/regression checks and basic PHP 7.4 compatibility guards.
Changes:
- Introduces Pest bootstrap/config and security-focused Pest test suites.
- Adds source-scanning tests for prepared-statement usage and setup.php structure.
- Adds a minimal
composer.jsonfor dev dependencies and a Dependabot configuration file.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
tests/Pest.php |
Pest entrypoint that loads the test bootstrap. |
tests/bootstrap.php |
Defines Cacti/framework function stubs for isolated testing. |
tests/Security/SetupStructureTest.php |
Static checks that setup.php contains required plugin hook functions and version keys. |
tests/Security/PreparedStatementConsistencyTest.php |
Static scan intended to prevent reintroduction of raw db_* calls. |
tests/Security/Php74CompatibilityTest.php |
Static scan for a few PHP 8.0-only constructs. |
composer.json |
Adds Pest v1 as a dev dependency and dev autoloading. |
.github/dependabot.yml |
Adds Dependabot configuration (currently npm + GitHub Actions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dabot - Throw RuntimeException when realpath/file_get_contents fails (previously silent continue hid unscanned files) - Fix Dependabot ecosystem from npm to composer - Remove committed .omc session artifacts, add .omc/ to .gitignore Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
Converted to draft to serialize the stack in this repo. Blocked by #250; will un-draft after that merges to avoid cross-PR merge conflicts. |
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
TheWitness
left a comment
There was a problem hiding this comment.
No composer.json or composer.lock in pluins.
|
Closing in favor of #260, which keeps this PR's test coverage and functions.php/database.php fixes but reworks the harness and CI workflow to match plugin_evidence's Cacti-checkout-based approach. Thank you for the contribution, @somethingwithproof! |
…ased CI (#260) * ci: add dependabot config with npm and github-actions * ci: add CodeQL (JS/TS, excludes PHP) with workflow_dispatch * ci: remove CodeQL JS/TS workflow (no JavaScript in this repo) * test: add Pest v1 security test infrastructure Add source-scan tests verifying security patterns (prepared statements, output escaping, auth guards, PHP 7.4 compatibility) remain in place across refactors. Tests run with Pest v1 (PHP 7.3+) and stub the Cacti framework so plugins can be tested in isolation. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(tests): harden Pest infra - fail-fast on missing files, fix dependabot - Throw RuntimeException when realpath/file_get_contents fails (previously silent continue hid unscanned files) - Fix Dependabot ecosystem from npm to composer - Remove committed .omc session artifacts, add .omc/ to .gitignore Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * style: remove trailing double semicolons Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test: make security checks executable on PHP 7.4 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * Add comprehensive FlowView test harness Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test: rework FlowView test harness to match plugin_evidence's Cacti-based CI - drop the local composer.json/composer.lock dependency and the custom tests.yml workflow in favor of plugin_evidence's plugin-ci-workflow.yml, which checks out a real Cacti install and reuses its vendor Pest/PHPUnit - adopt plugin_evidence's tests/.cacti-version, tests/Pest.php, tests/TestCase.php and tests/bootstrap-unit.php, adapted for FlowView - drop the PDO-backed Contract/Integration suites and php-syntax.sh script; PHP syntax and a live MariaDB poller run are now covered by the CI workflow itself, matching plugin_evidence - broaden the PHP 7.4 compatibility check to scan the plugin tree recursively like plugin_evidence instead of a fixed file list - point phpunit.xml at the new bootstrap and Cacti's own vendor tree - update tests/README.md to describe testing against a working Cacti install instead of a local composer install Attribution: builds on the FlowView test harness proposed in #251 by @somethingwithproof. --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> Co-authored-by: Thomas Vincent <thomasvincent@gmail.com>
Summary
functions.phpanddatabase.phpbehind stateful Cacti API and PDO test doublesCorrectness fixes covered by regressions
IN ()clauses and reject invalid addressesLIKEmetacharactersValidation
git diff --checkpassesPHP 7.4 is exercised in CI because it is no longer buildable with the current macOS toolchain used for local validation.