fix: add WP constants, WP_Query mock, fix arg types and stubs
- bootstrap: define DAY_IN_SECONDS, ARRAY_A, mock WP_Query class - CostTrackerTest: fix log_api_call signature (post_id is ?int, not string) - PublisherTest: fix apply_filters usage, remove broken expectation - OpenRouterPricingTest: fix assertGreaterThanOrEqual direction - OpenRouterProviderTest: add wp_salt stub, use empty API key - ContentAnalyzerTest: add apply_filters, current_time, get_results stubs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,11 +39,16 @@ class ContentAnalyzerTest extends BaseTestCase {
|
||||
'prautoblogger_monthly_budget_usd' => '50.00',
|
||||
] );
|
||||
|
||||
// Stub additional WP functions used by analyze_recent_data.
|
||||
Functions\when( 'apply_filters' )->returnArg( 2 );
|
||||
$this->stub_current_time( '2026-04-12 10:00:00' );
|
||||
|
||||
// Stub $wpdb for any database calls.
|
||||
$wpdb = $this->create_mock_wpdb();
|
||||
$wpdb->method( 'prepare' )->willReturn( 'prepared' );
|
||||
$wpdb->method( 'get_var' )->willReturn( '0' );
|
||||
$wpdb->method( 'get_results' )->willReturn( [] );
|
||||
$wpdb->method( 'get_results' )->willReturn( [] );
|
||||
$GLOBALS['wpdb'] = $wpdb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user