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:
peptiderepo
2026-04-12 08:17:18 +07:00
parent ece032efe5
commit 7728db5671
6 changed files with 81 additions and 25 deletions

View File

@@ -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;
}