Fix: Use WP_Mock::userFunction in AdminTest
- Replaces deprecated expectFunction with userFunction. - Fixes PHPUnit failure in CI. Fix: Address PHPCS warning for unused param - Prefixes unused with underscore in Admin class.
This commit is contained in:
@@ -41,11 +41,11 @@ class Admin {
|
|||||||
/**
|
/**
|
||||||
* Enqueues admin scripts and styles.
|
* Enqueues admin scripts and styles.
|
||||||
*
|
*
|
||||||
* @param string $hook_suffix The current admin page.
|
* @param string $_hook_suffix The current admin page.
|
||||||
|
*
|
||||||
* @phpcs:ignore WordPress.CodeAnalysis.UnusedFunctionParameter.Found
|
* @phpcs:ignore WordPress.CodeAnalysis.UnusedFunctionParameter.Found
|
||||||
*/
|
*/
|
||||||
public function enqueue_admin_assets( $hook_suffix ) {
|
public function enqueue_admin_assets( string $_hook_suffix ) {
|
||||||
// Enqueue admin styles.
|
// Enqueue admin styles.
|
||||||
\wp_enqueue_style(
|
\wp_enqueue_style(
|
||||||
'wpst-admin-style',
|
'wpst-admin-style',
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class AdminTest extends \WP_Mock\Tools\TestCase {
|
|||||||
$version = '1.0.0'; // Match the version returned by the mocked core->get_plugin_version()
|
$version = '1.0.0'; // Match the version returned by the mocked core->get_plugin_version()
|
||||||
|
|
||||||
// Expect wp_enqueue_style to be called
|
// Expect wp_enqueue_style to be called
|
||||||
\WP_Mock::expectFunction(
|
\WP_Mock::userFunction(
|
||||||
'wp_enqueue_style',
|
'wp_enqueue_style',
|
||||||
[
|
[
|
||||||
'times' => 1,
|
'times' => 1,
|
||||||
@@ -87,7 +87,7 @@ class AdminTest extends \WP_Mock\Tools\TestCase {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Expect wp_enqueue_script to be called
|
// Expect wp_enqueue_script to be called
|
||||||
\WP_Mock::expectFunction(
|
\WP_Mock::userFunction(
|
||||||
'wp_enqueue_script',
|
'wp_enqueue_script',
|
||||||
[
|
[
|
||||||
'times' => 1,
|
'times' => 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user