Skip to content

test: extract test cases from #20 into current Pest framework - #27

Merged
TheWitness merged 2 commits into
developfrom
ci/net-test-cases
Sep 17, 2026
Merged

TheWitness merged 2 commits into
developfrom
ci/net-test-cases

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Extracts the meaningful test cases from #20 (test/add-security-test-infrastructure) and adapts them to run inside the Pest test framework already merged via #26 (tests/bootstrap-unit.php, tests/TestCase.php, root phpunit.xml), rather than the standalone composer/bootstrap.php scaffold #20 introduced.

Carried over:

  • tests/Security/SetupStructureTest.php: replaced the regex-based INFO name/version checks with test: add Pest v1 security test infrastructure #20's cleaner approach — parse the INFO file directly and assert on the resulting array with toHaveKey().
  • tests/Security/Php74CompatibilityTest.php: added test: add Pest v1 security test infrastructure #20's PHP 8.0-construct checks (str_contains, str_starts_with, str_ends_with, nullsafe operator) for its entry-point file list (cli.php, config.php, controllers/cacti.php, controllers/hosts.php, controllers/services.php, setup.php), with fail-fast error handling on unreadable files, as additional test cases alongside the existing coverage.

Intentionally not carried over (superseded by #26's framework already on develop):

  • composer.json / composer.lock (plugins don't ship a composer.json)
  • phpunit.xml, tests/Pest.php, tests/bootstrap.php
  • the .gitignore addition (not a test case)

Closes #20.

- SetupStructureTest: parse INFO directly and assert name/version keys via
  toHaveKey() instead of regex-matching the raw source, per PR #20.
- Php74CompatibilityTest: add PHP 8.0-construct checks (str_contains,
  str_starts_with, str_ends_with, nullsafe operator) for the entry-point
  files (cli.php, config.php, controllers/cacti.php, controllers/hosts.php,
  controllers/services.php, setup.php) covered by PR #20, with fail-fast
  error handling on unreadable files.

composer.json/composer.lock/phpunit.xml/tests/bootstrap.php from PR #20 are
intentionally not carried over since this repo already has an equivalent,
newer Pest test framework (tests/bootstrap-unit.php, tests/TestCase.php,
root phpunit.xml) merged via #26.
Copilot AI lite review requested due to automatic review settings September 17, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The setup test no longer verifies that setup.php loads metadata from INFO.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adapts security tests from #20 to the existing Pest framework from #26.

Changes:

  • Parses INFO directly for metadata assertions.
  • Adds PHP 8 compatibility checks for entry-point files.
File summaries
File Description
tests/Security/SetupStructureTest.php Validates parsed plugin metadata.
tests/Security/Php74CompatibilityTest.php Scans entry points for PHP 8-only syntax.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment thread tests/Security/SetupStructureTest.php Outdated
Address Copilot review feedback on #27 - toHaveKey() alone would still
pass if setup.php stopped loading INFO via parse_ini_file(), so keep the
source-level check alongside the parsed-metadata assertion.
@TheWitness
TheWitness merged commit d522de9 into develop Sep 17, 2026
3 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