From 07d0e7e44b1d1408e94e6a5540af0bf86db337dd Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:06:08 +0100 Subject: [PATCH] Fix: Resolve CI PHPCS and PHPUnit errors (attempt 3) - Correct docblock spacing and remove trailing whitespace in Admin class. - Restore wp_create_nonce mock in AdminTest, required by tested method. --- includes/Admin/class-admin.php | 2 +- tests/test-admin.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/Admin/class-admin.php b/includes/Admin/class-admin.php index d2064e1..feb088a 100644 --- a/includes/Admin/class-admin.php +++ b/includes/Admin/class-admin.php @@ -41,11 +41,11 @@ class Admin { /** * Enqueues admin-specific scripts and styles. * - * * @phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid * @param string $hook_suffix The current admin page. */ public function enqueue_admin_assets( $hook_suffix ) { + // Enqueue admin styles. \wp_enqueue_style( 'wpst-admin-style', diff --git a/tests/test-admin.php b/tests/test-admin.php index bdd07c7..5fd5668 100644 --- a/tests/test-admin.php +++ b/tests/test-admin.php @@ -109,6 +109,15 @@ class AdminTest extends \WP_Mock\Tools\TestCase { 'return' => $expected_data['ajax_url'], ] ); + // We need to mock wp_create_nonce as it's called directly in the method + \WP_Mock::userFunction( + 'wp_create_nonce', + [ + 'times' => 1, + 'args' => [ 'wpst_admin_nonce' ], // Match the action string used in class-admin.php + 'return' => $expected_data['nonce'], + ] + ); \WP_Mock::userFunction( 'wp_localize_script', [