diff --git a/tests/test-admin.php b/tests/test-admin.php index 56a4b31..2c72548 100644 --- a/tests/test-admin.php +++ b/tests/test-admin.php @@ -39,14 +39,14 @@ class AdminTest extends \WP_Mock\Tools\TestCase { // Mock Core class $this->core = $this->createMock(Core::class); - // Instantiate the class under test first - $this->admin = new Admin($this->core); - - // Set up WordPress function mocks after instantiation to use the correct object reference + // Set up WordPress function mocks BEFORE instantiating Admin WP_Mock::userFunction('add_action', [ 'times' => 1, - 'args' => ['admin_enqueue_scripts', [$this->admin, 'enqueue_admin_assets']] + 'args' => ['admin_enqueue_scripts', \Mockery::type('callable')] ]); + + // Instantiate the class under test + $this->admin = new Admin($this->core); } /**