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.
This commit is contained in:
@@ -41,11 +41,11 @@ class Admin {
|
|||||||
/**
|
/**
|
||||||
* Enqueues admin-specific scripts and styles.
|
* Enqueues admin-specific scripts and styles.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
* @phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
||||||
* @param string $hook_suffix The current admin page.
|
* @param string $hook_suffix The current admin page.
|
||||||
*/
|
*/
|
||||||
public function enqueue_admin_assets( $hook_suffix ) {
|
public function enqueue_admin_assets( $hook_suffix ) {
|
||||||
|
|
||||||
// Enqueue admin styles.
|
// Enqueue admin styles.
|
||||||
\wp_enqueue_style(
|
\wp_enqueue_style(
|
||||||
'wpst-admin-style',
|
'wpst-admin-style',
|
||||||
|
|||||||
@@ -109,6 +109,15 @@ class AdminTest extends \WP_Mock\Tools\TestCase {
|
|||||||
'return' => $expected_data['ajax_url'],
|
'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_Mock::userFunction(
|
||||||
'wp_localize_script',
|
'wp_localize_script',
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user