Testing Tools

ToolTypePurpose
PHPUnitUnit/IntegrationPHP logic testing
WPAuditPerformanceWordPress-specific performance audit
pa11y-ciAccessibilityAutomated WCAG2AA checking (threshold 0; see .pa11yci.json)

PHPUnit

PHPUnit coverage is the WPAudit suite in tools/wpaudit/. CI runs the same command. There is no separate tests/Unit tree in this theme.

Running PHPUnit

Copied!
Shell
# Same as CIcomposer test:wpaudit# Or from the package directorycomposer install --working-dir=tools/wpauditcomposer test --working-dir=tools/wpauditcomposer test:coverage --working-dir=tools/wpaudit

Configuration

PHPUnit is configured in tools/wpaudit/phpunit.xml (PHPUnit 10.5, bootstrap vendor/autoload.php).

Test Structure

Copied!
Directory tree
tools/wpaudit/├── phpunit.xml├── src/ # Analyzers, models, configuration└── tests/Unit/ # PHPUnit tests (WPAudit\Tests\)

Writing Tests

Add cases under tools/wpaudit/tests/Unit/ in the WPAudit\Tests\ namespace. See existing analyzer and model tests in that tree.

WPAudit

WPAudit is the PHPUnit package in tools/wpaudit/. It analyzes theme files for performance, SEO, and accessibility findings. Run it with composer test:wpaudit. Rule IDs and configuration are documented in tools/wpaudit/README.md.

pa11y-ci (Accessibility)

pa11y-ci runs automated accessibility tests against rendered pages (home, post, search, page, 404), checking for WCAG2AA violations with a zero-issue threshold.

Running pa11y

Copied!
Shell
npm run test:a11y # Uses .pa11yci.json (defaults to http://localhost:8080/)npm run test:a11y:env # Single URL against wp-env (http://localhost:8888/)

Prerequisites

A WordPress site must be reachable at the configured host:

Copied!
Shell
# CI-style host (8080) — match .pa11yci.jsonnpm run test:a11y# Local wp-envnpm run env:startnpm run test:a11y:env

Configuration

Defaults live in .pa11yci.json. The CI accessibility workflow (accessibility.yml) seeds a post and page, writes .pa11yci.ci.json with resolved ?p= / ?page_id= URLs (because php -S does not rewrite pretty permalinks), then runs pa11y-ci --threshold 0.

Copied!
JSON
{ "defaults": { "timeout": 60000, "wait": 1000, "standard": "WCAG2AA", "runners": ["axe", "htmlcs"], "ignore": ["warning"] }, "urls": [ "http://localhost:8080/", "http://localhost:8080/?p=1", "http://localhost:8080/?s=test", "http://localhost:8080/?page_id=2", "http://localhost:8080/?p=999999" ]}

.pa11yci.ci.json is gitignored. For wp-env, use npm run test:a11y:env or retarget the urls host to 8888.

What pa11y Checks

CategoryExamples
Color contrastText against backgrounds
ARIA usageCorrect roles, states, properties
Form labelsInputs with associated labels
HeadingsLogical heading hierarchy
ImagesAlt text presence
LinksDistinguishable link text
LandmarksProper page regions
KeyboardFocus order and visibility

Handling False Positives

If pa11y reports an issue that is a false positive:

  1. Verify the issue is genuinely a false positive by manual testing.
  2. Add the specific rule to the ignore list in the configuration.
  3. Document why the rule is ignored.

Running All Tests

To run the complete test suite:

Copied!
Shell
npm run test

This typically runs:

  1. PHPUnit tests.
  2. JavaScript tests (if any).
  3. Linting checks.

For a comprehensive check including accessibility:

Copied!
Shell
npm run test:a11ycomposer test:wpaudit

Continuous Integration

Tests run automatically on every pull request:

CheckTriggerMust Pass
PHPUnitEvery PRYes
ESLintEvery PRYes
stylelintEvery PRYes
PHPCSEvery PRYes
pa11y-ciEvery PRYes
WPAuditNightly / ReleaseAdvisory

PRs cannot be merged if any required check fails.

Test Coverage

To generate a code coverage report:

Copied!
Shell
./vendor/bin/phpunit --coverage-html coverage/

Open coverage/index.html in a browser to view the report.

Coverage targets:

AreaTarget
Service classes80%+
Utility functions90%+
Block registration70%+
Overall75%+

WordPress 7.1 Compatibility Checklist

Run this matrix before raising Tested up to to 7.1. Do not remove Aegis breakpoints; they complement Core responsive style states (see Enhanced Core Blocks).

CheckHow
Core responsive style statesEdit Group/Columns/Image/Heading/Button with viewport styles; confirm front-end CSS
Aegis Display / visibilityToggle hide-on-mobile, display/order/width; confirm Landscape/Tablet buttons still work
Iframed editorPost Editor + Site Editor: Global Styles, overlays, icons, Aegis inspector panels
React 19 experimentEnable Gutenberg gutenberg-react-19; open theme blocks and Aegis Dash admin/editor UIs; watch console
Regression baselineSpot-check the same flows on WordPress 7.0

Static scan (theme + Aegis Dash sources): no __next40pxDefaultSize or useResizeCanvas usage found. Vendored map libraries in Aegis Pro may still reference legacy React APIs — retest those screens under the React 19 experiment and update upstream packages when available.

Next Steps