Skip to content

test: add coverage for a few uncovered pure setup.php helpers - #372

Merged
bmfmancini merged 1 commit into
developfrom
test/expand-coverage
Sep 23, 2026
Merged

bmfmancini merged 1 commit into
developfrom
test/expand-coverage

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

setup.php has a handful of small, pure functions that had no test coverage at all: plugin_syslog_version(), syslog_check_dependencies(), syslog_top_graph_refresh(), and syslog_draw_navigation_text(). This PR adds coverage for those four.

Scope note

This is deliberately narrow. This plugin's setup.php also contains much larger functions (plugin_syslog_install()/uninstall(), syslog_connect(), syslog_check_upgrade(), syslog_install_advisor(), etc.) that do real database connection setup, read/write config files, and emit header()/exit flows. Given this plugin's large, actively-developed existing test suite (147 tests across tests/Security and tests/Unit alone, plus separate regression/E2E/browser suites), I intentionally did not add speculative new stubs/mocks for those more involved functions in this PR - happy to follow up separately if useful.

Result

Verified via a real WSL Cacti install (full existing suite re-run to confirm no regressions from the addition):

Tests:    147 passed (687 assertions)
Duration: 2.30s

(up from 143 passed before this PR)

setup.php has a handful of small, pure functions that had no test
coverage at all: plugin_syslog_version(), syslog_check_dependencies(),
syslog_top_graph_refresh(), and syslog_draw_navigation_text().

Added tests/Unit/SetupSmallHelpersTest.php covering all four.

Deliberately narrow in scope: this plugin's setup.php also contains
much larger functions (plugin_syslog_install/uninstall(),
syslog_connect(), syslog_check_upgrade(), syslog_install_advisor(),
etc.) that do real database connection setup, read/write config
files, and emit header()/exit flows - those are intentionally left
untouched here rather than risk destabilizing this plugin's large,
actively-developed existing test suite (147 tests across
tests/Security and tests/Unit alone, plus regression/E2E/browser
suites) with speculative new stubs/mocks for functions this involved.

Verified via a real WSL Cacti install: 147 passed (687 assertions), up
from 143 passed before this PR - full existing suite re-run to confirm
no regressions from the bootstrap/test additions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused test addition is low risk; only a minor changelog documentation nit remains.

Review effort: Lite
Findings: None

What changed in this PR

Adds focused unit-test coverage for four small setup.php helpers.

Changes:

  • Tests plugin metadata and dependency checks.
  • Tests graph refresh passthrough and navigation preservation.
File Summary
tests/​Unit/​SetupSmallHelpersTest.php Adds unit tests for four setup helpers; a changelog entry is recommended.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bmfmancini bmfmancini left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bmfmancini
bmfmancini merged commit 81b48bb into develop Sep 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants