Skip to content

test: cover handler-free device row and sites filter markup - #395

Merged
TheWitness merged 1 commit into
developfrom
test/csp-handler-coverage
Oct 16, 2026
Merged

TheWitness merged 1 commit into
developfrom
test/csp-handler-coverage

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Follow-up to #394, whose "Enforce coverage of changed lines" check failed on all PHP versions with Patch coverage: 0.00% (0/5 lines). The uncovered lines were in lib/mactrack_functions.php:

  • the device rescan icon in mactrack_format_device_row()
  • the filter selects/checkbox in mactrack_site_filter()

Adds tests/Unit/MactrackInlineHandlerMarkupTest.php, which renders both and asserts:

  • the rescan icon exposes class='mactrackRescanDevice' and data-device-id, with no onclick
  • disabled devices get no rescan icon
  • the sites filter has no onchange/onclick attributes, all control ids are present, and the $(function() {}) block binds the change/click handlers

The page entry points are already in the patch-coverage allowlist, so no change to patch-coverage.php is needed.

Validated locally with PHPUnit 10.5 in a scratch Cacti layout: the new test passes (3 tests), as do the other class-based tests (81 total). The Pest-style tests were not run locally; CI will run them.

The coverage gate for #394 reported 0/5 changed lines in
lib/mactrack_functions.php: the rescan icon in mactrack_format_device_row()
and the filter selects in mactrack_site_filter(). Add unit tests that render
both and assert the class/data-attribute hooks, the absence of inline
onClick/onChange attributes, and the $(function() {}) bindings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 15:33

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.

🟢 Approval recommended

The remaining shared-stub placement concern is non-blocking, with no demonstrated functional failure.

1 open finding
What changed in this PR

Adds regression coverage for shared markup changed in #394’s inline-handler removal.

Changes:

  • Tests rescan hooks for enabled devices and their absence for disabled devices.
  • Checks sites-filter control IDs, event bindings, and absence of inline handlers.
File Description
tests/​Unit/​MactrackInlineHandlerMarkupTest.php Adds three device-row and sites-filter markup tests.

🧠 Review effort: Balanced


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

Comment thread tests/Unit/MactrackInlineHandlerMarkupTest.php
@TheWitness
TheWitness merged commit 0ca0e4a into develop Oct 16, 2026
6 checks passed
@TheWitness
TheWitness deleted the test/csp-handler-coverage branch October 16, 2026 16:47
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