diff --git a/tests/unit/inc/addon-manager-test.php b/tests/unit/inc/addon-manager-test.php index 9cddf533cde..62528d10d9e 100644 --- a/tests/unit/inc/addon-manager-test.php +++ b/tests/unit/inc/addon-manager-test.php @@ -1157,8 +1157,12 @@ public function test_create_notification( $product_name, $short_link ) { ] ); + $admin_user = Mockery::mock( WP_User::class ); + $admin_user->ID = 1; + Monkey\Functions\expect( 'wp_get_current_user' ) - ->twice(); + ->twice() + ->andReturn( $admin_user ); Monkey\Functions\expect( 'YoastSEO' ) ->once() diff --git a/tests/unit/integrations/admin/indexing-notification-integration-test.php b/tests/unit/integrations/admin/indexing-notification-integration-test.php index 7466eefedd8..256fe4d1848 100644 --- a/tests/unit/integrations/admin/indexing-notification-integration-test.php +++ b/tests/unit/integrations/admin/indexing-notification-integration-test.php @@ -344,8 +344,10 @@ public function test_maybe_create_notification_with_indexing_failed_reason() { ->once() ->andReturn( Indexing_Reasons::REASON_INDEXING_FAILED ); + $admin_user = Mockery::mock( WP_User::class ); + $admin_user->ID = 1; Monkey\Functions\expect( 'wp_get_current_user' ) - ->andReturn( 'user' ); + ->andReturn( $admin_user ); $this->notification_helper ->expects( 'restore_notification' ) @@ -400,8 +402,10 @@ public function test_maybe_create_notification_with_indexing_reasons( $reason ) ->once() ->andReturn( $reason ); + $admin_user = Mockery::mock( WP_User::class ); + $admin_user->ID = 1; Monkey\Functions\expect( 'wp_get_current_user' ) - ->andReturn( 'user' ); + ->andReturn( $admin_user ); $this->notification_helper ->expects( 'restore_notification' ) diff --git a/tests/unit/integrations/third-party/wpml-wpseo-notification-test.php b/tests/unit/integrations/third-party/wpml-wpseo-notification-test.php index d4799c20903..0dcfea3183d 100644 --- a/tests/unit/integrations/third-party/wpml-wpseo-notification-test.php +++ b/tests/unit/integrations/third-party/wpml-wpseo-notification-test.php @@ -120,8 +120,10 @@ public function test_notifies_when_not_installed() { // Mock that the Yoast SEO Multilingual plugin is not installed and activated. $this->wpml_wpseo_conditional->expects( 'is_met' )->andReturnFalse(); + $admin_user = Mockery::mock( WP_User::class ); + $admin_user->ID = 1; Monkey\Functions\expect( 'wp_get_current_user' ) - ->andReturn( 'user' ); + ->andReturn( $admin_user ); $this->notification_center ->expects( 'add_notification' )