test: revert global current_time stub (conflicts with Patchwork)
Patchwork (used by Brain Monkey) requires it be loaded before any function it may need to redefine. Defining current_time() in bootstrap triggers DefinedTooEarly exceptions across the suite. Will mock via Functions\when() in BaseTestCase::setUp instead. Agent-Session: cowork-ci-parity-20260414
This commit is contained in:
@@ -61,22 +61,6 @@ if ( ! defined( 'OBJECT' ) ) {
|
|||||||
define( 'OBJECT', 'OBJECT' );
|
define( 'OBJECT', 'OBJECT' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* current_time() stub — WordPress returns formatted timestamps.
|
|
||||||
* Used by class-logger.php (which Publisher/ChiefEditor/etc call).
|
|
||||||
* Using a real function (not Brain Monkey mock) so tests that don't explicitly
|
|
||||||
* set up expectations for current_time still get a sensible value.
|
|
||||||
*/
|
|
||||||
if ( ! function_exists( 'current_time' ) ) {
|
|
||||||
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
|
|
||||||
function current_time( $type = 'mysql', $gmt = 0 ) {
|
|
||||||
if ( $type === 'timestamp' || $type === 'U' ) {
|
|
||||||
return time();
|
|
||||||
}
|
|
||||||
return gmdate( 'Y-m-d H:i:s' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal WP_Query stub for unit tests.
|
* Minimal WP_Query stub for unit tests.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user