fair-plugin/tests/unit/multisite.xml
Chuck Adams 4f3e7d7b71
Phase 13: coverage baseline + Infection mutation testing
Docker-based mutation testing with PHP 8.5 + latest Infection:

tests/sites/ephemeral/mutation/Dockerfile: PHP 8.5-cli-alpine + mysqli + xdebug
tests/sites/ephemeral/mutation/docker-compose.yml: MySQL 8.0 + mutation container
  - composer install --ignore-platform-reqs (PHP 8.5 resolves infection 0.27)
  - Auto-detects configured MySQL via FAIR_TEST_DB_* env vars
  - Runs infection --threads=2 --no-progress

tests/infection-bootstrap.php: FAIR autoloader + WordPress class/function stubs
  - Registers FAIR class autoloader for source reflection
  - Stubs WP_List_Table, WP_Upgrader, Plugin_Upgrader, WP_Error
  - Stubs Fragen\Git_Updater\Lite to prevent die() in class-lite.php
  - Stubs esc_*(), __(), sanitize_text_field(), wp_unslash(), etc.

infection.json: source in inc/ (excluding admin, wp-cli, settings, etc.)

Results: 486 mutations, 45 killed, 440 uncovered, 1 escaped, 0 errors
  Covered Code MSI: 97% (of tested code, almost all mutations caught)
  Overall MSI: 9% (most modules excluded from unit test coverage)

composer.json: restored from release (was corrupt with scripts-only).
  Added 'infection' script: docker compose run mutation.
bin/setup-local-tests.php: added FAIR_TEST_DB_* env var detection
  before local/docker auto-detection for containerized usage.
tests/unit/phpunit.xml, multisite.xml: added executionOrder=default

Signed-off-by: Chuck Adams <chaz@chaz.works>
2026-06-09 14:46:33 -06:00

39 lines
1.1 KiB
XML

<?xml version="1.0"?>
<phpunit
bootstrap="./bootstrap.php"
backupGlobals="false"
colors="true"
executionOrder="default"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
convertDeprecationsToExceptions="true"
>
<php>
<const name="WP_TESTS_MULTISITE" value="1" />
</php>
<testsuites>
<!-- Default test suite to run all tests. -->
<testsuite name="default">
<directory suffix=".php">./tests</directory>
<exclude>./tests/SampleTest.php</exclude>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>ms-excluded</group>
</exclude>
</groups>
<coverage includeUncoveredFiles="true" processUncoveredFiles="false" pathCoverage="false" cacheDirectory="./cache">
<include>
<directory suffix=".php">../../inc</directory>
</include>
<report>
<text outputFile="php://stdout" showOnlySummary="true"/>
<html outputDirectory="./coverage/html/multisite"/>
<php outputFile="./coverage/php/multisite.php"/>
</report>
</coverage>
</phpunit>