Files
2meet-data-optimizer/tests/live/run.php
T
wpdev f72a315986 test(2meet-data-optimizer): add live test runner and failing shadow_read write suite
- Add tests/live: a `wp eval-file` runner (PASS/FAIL/XFAIL/XPASS/SKIP) with
  fixtures that override entity modes in process (pre_option) and read
  native / flat values with plain SQL, so WP core meta flows run for real
- shadow_write suite reproduces the dev36 finding: in shadow_read,
  update_*_meta returns false and native meta is never written
  (3 XFAIL marked for PR-056); the dual_write control passes
- Move the dev36 integration harness into tests/live/tools; outputs go to
  cwd / $TMDO_LIVE_OUT, site URL and path are env-configurable
- Verify: wp --path=<dev36> eval-file tests/live/run.php shadow_write
  → 1 passed, 3 xfail; unit 658 OK, integration 480 OK,
  phpcs (phpcs.xml) 0, stan OK
- PR: PR-052
2026-09-26 18:21:31 +08:00

50 lines
1.5 KiB
PHP

<?php
/**
* Live test runner — runs suites inside a real WordPress site (HivePress /
* WooCommerce active) so WP core meta flows and query SQL are exercised for real.
*
* Usage:
* wp --path=<site> eval-file tests/live/run.php <suite> [<suite> ...]
*
* Exit code 0 when every test passed (XFAIL allowed), 1 otherwise.
* Never run against a production site: suites create and delete fixtures.
*
* No strict_types here: wp eval-file evals this file, and a declare must be
* the first statement of a real file. The required files declare it.
*
* @package WP_Data_Optimizer
*/
require __DIR__ . '/lib/assert.php';
require __DIR__ . '/lib/fixtures.php';
$tmdo_live_suites = isset( $args ) ? (array) $args : array();
if ( ! class_exists( 'TMDO_Hook_Bus' ) ) {
fwrite( STDERR, "2meet-data-optimizer is not active on this site.\n" );
exit( 1 );
}
if ( empty( $tmdo_live_suites ) ) {
$tmdo_live_available = array_map(
static function ( $f ) {
return basename( $f, '.php' );
},
glob( __DIR__ . '/suites/*.php' )
);
fwrite( STDERR, 'Usage: wp eval-file tests/live/run.php <suite> ... Suites: ' . implode( ', ', $tmdo_live_available ) . "\n" );
exit( 1 );
}
foreach ( $tmdo_live_suites as $tmdo_live_suite ) {
$tmdo_live_file = __DIR__ . '/suites/' . basename( (string) $tmdo_live_suite ) . '.php';
if ( ! is_file( $tmdo_live_file ) ) {
fwrite( STDERR, "Unknown suite: {$tmdo_live_suite}\n" );
exit( 1 );
}
TMDO_Live::$suite = (string) $tmdo_live_suite;
require $tmdo_live_file;
}
exit( TMDO_Live::run() ? 0 : 1 );