Fix: Address CI failures

- Move @phpcs:ignore for unused param above function signature.
- Add WP_Mock for admin_url() in AdminTest to fix PHPUnit error.
This commit is contained in:
2025-04-18 19:55:20 +01:00
parent ed7d33e2aa
commit cc6acc2a4e
2 changed files with 14 additions and 2 deletions

View File

@@ -96,6 +96,19 @@ class AdminTest extends \WP_Mock\Tools\TestCase {
);
// Expect wp_localize_script to be called
$expected_data = [
'ajax_url' => 'mock_ajax_url',
'nonce' => 'mock_nonce',
];
// Mock admin_url() before wp_localize_script uses it
\WP_Mock::userFunction(
'admin_url',
[
'times' => 1,
'args' => [ 'admin-ajax.php' ],
'return' => $expected_data['ajax_url'],
]
);
\WP_Mock::userFunction(
'wp_localize_script',
[