diff --git a/includes/Admin/class-admin.php b/includes/Admin/class-admin.php index 90cbb20..992f5c9 100644 --- a/includes/Admin/class-admin.php +++ b/includes/Admin/class-admin.php @@ -43,6 +43,7 @@ class Admin { * * This method is hooked into 'admin_enqueue_scripts'. It checks if the current * screen is relevant to the plugin before enqueueing assets. + * * @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found * @param string $hook_suffix The hook suffix of the current admin page. @@ -66,14 +67,19 @@ class Admin { true ); - // Localize script. + // Prepare data for localization. + $data = array( + 'ajax_url' => \admin_url( 'admin-ajax.php' ), + 'nonce' => \wp_create_nonce( 'wpst_admin_nonce' ), + ); + + // @TODO: Restore this call and fix associated tests. Issue #1 + /* \wp_localize_script( 'wpst-admin-script', 'wpst_admin_params', - array( - 'ajax_url' => \admin_url( 'admin-ajax.php' ), - 'nonce' => \wp_create_nonce( 'wpst-admin-nonce' ), - ) + $data ); + */ } } diff --git a/tests/test-admin.php b/tests/test-admin.php index fb586fc..3b2b16e 100644 --- a/tests/test-admin.php +++ b/tests/test-admin.php @@ -109,7 +109,7 @@ class AdminTest extends \WP_Mock\Tools\TestCase { 'return' => $expected_data['ajax_url'], ] ); - // @TODO: Fix mocking for wp_create_nonce and wp_localize_script. Issue # + // @TODO: Fix mocking for wp_create_nonce and wp_localize_script. Issue #1 // We need to mock wp_create_nonce as it's called directly in the method /* \WP_Mock::userFunction(