Skip to main content

Version Docs Updated

Purpose

This page explains Rentiva's test ecosystem — PHPUnit configuration, CI matrix, Docker wrappers, and the custom Listener structure — to developers.

Test Suite Architecture

Rentiva uses a PHPUnit 9.6 infrastructure customized for WordPress. This infrastructure is reinforced with custom tooling that guarantees both test speed and database cleanup quality.


Current Test Baseline

VersionTestsAssertionsSkippedDate
v4.23.0 (current)5672036426.03.2026
v4.22.25622024425.03.2026
v4.22.0 (T8+T9 milestone)563202224.03.2026
v4.21.27+T8517196324.03.2026
v4.21.274631901
v4.20.0 (initial locked baseline)2681379

Test Categories

Shortcode Render Tests

13 shortcode render test files validate the output of all shortcodes. These tests cover the CAM pipeline end-to-end: AllowlistRegistry -> CanonicalAttributeMapper -> shortcode render().

SettingsSanitizer Tests

4 SettingsSanitizer test files test the sanitization and validation of settings values.

AllowlistRegistry Tests

199 unique attribute keys, 19 TAG_MAPPING entries, and consistency of enum values are verified.

KeyNormalizer Tests

27 tests, 32 assertions — camelCase/snake_case conversion, alias resolution, and edge cases.


CI Matrix

The CI pipeline runs on the following matrix:

PHP 8.1PHP 8.2PHP 8.3
WP 6.7PHPUnitPHPUnitPHPUnit
WP latestPHPUnitPHPUnit + PHPCSPHPUnit
  • Total: 6 parallel jobs (PHP 8.1/8.2/8.3 x WP 6.7/latest)
  • PHPCS gate: Runs via composer phpcs on PHP 8.2 and is a mandatory gate
  • Merging is not allowed until all jobs pass

Core Components

1. PHPUnit Configuration (phpunit.xml)

The test process bootstraps the WordPress test environment via tests/bootstrap.php.

  • Coverage: Tracks the ./src/ directory with a target of 100% coverage.
  • Multisite: Set to 0 (false) by default.

2. MHM Test Listener (MHM_Test_Listener)

A custom listener that applies the "Hybrid Reset" strategy.

  • Purpose: Automatically cleans up temporary tables (with wptests_ prefix) created during isolated test runs (MHM_TEST_IS_ISOLATED).
  • Safety: Only deletes tables matching a controlled pattern (DROP TABLE IF EXISTS).

Docker and CLI Usage

Tests run inside an isolated Docker container regardless of the host OS (Windows/macOS/Linux).

# Run all tests
npm run test

# Run only a specific group
docker exec -it mhm-container vendor/bin/phpunit --group financial

# PHPCS check (CI gate)
composer phpcs

Code Coverage Report

The system enforces strict coverage rules for critical financial and core modules.

  • HTML Report: Generated in the build/coverage directory.
  • Critical Modules: src/Core/Financial and src/Core/Security modules are always audited.

Test Fixtures

Test data is kept in the tests/fixtures directory.

  • Idempotency: Because the database is cleaned before each test suite, tests are independent of each other.
  • Isolation: Thanks to MHM_Test_Listener, data does not collide during parallel test runs.

Section Summary

  • The test infrastructure is built on PHPUnit 9.6.
  • 567 tests, 2036 assertions (v4.23.0 baseline).
  • CI matrix: 6 jobs (PHP 8.1/8.2/8.3 x WP 6.7/latest) + PHPCS gate.
  • Database pollution is prevented with the Hybrid Reset strategy.
  • During development, npm run test is the primary validation command.

Changelog

DateVersionNote
23.04.20264.27.2English translation added.
27.03.20264.23.0Test baseline v4.23.0 (567/2036/4), CI matrix (6 jobs + PHPCS), test categories (shortcode render, sanitizer, allowlist, key normalizer) added.
19.03.20264.21.2PHPUnit 9.6 and MHM_Test_Listener documentation added.