diff --git a/tests/unit/content-type-visibility/application/content-type-visibility-watcher-actions-test.php b/tests/unit/content-type-visibility/application/content-type-visibility-watcher-actions-test.php index ea3d524b836..0bdfa23c33a 100644 --- a/tests/unit/content-type-visibility/application/content-type-visibility-watcher-actions-test.php +++ b/tests/unit/content-type-visibility/application/content-type-visibility-watcher-actions-test.php @@ -21,6 +21,13 @@ */ class Content_Type_Visibility_Watcher_Actions_Test extends TestCase { + /** + * Holds the admin user mock instance. + * + * @var WP_User + */ + private $admin_user; + /** * Holds the Options_Helper instance. * @@ -57,6 +64,9 @@ protected function set_up() { $this->stubTranslationFunctions(); + $this->admin_user = Mockery::mock( WP_User::class ); + $this->admin_user->ID = 1; + $this->options = Mockery::mock( Options_Helper::class ); $this->notification_center = Mockery::mock( Yoast_Notification_Center::class ); $this->content_type_dismiss_notifications = Mockery::mock( Content_Type_Visibility_Dismiss_Notifications::class ); @@ -310,10 +320,13 @@ public function test_maybe_add_notification() { [ 'esc_url' => 'https://yoa.st/3.0-content-types', 'admin_url' => 'admin.php?page=wpseo_page_settings', - 'wp_get_current_user' => Mockery::mock( WP_User::class ), ] ); + Monkey\Functions\expect( 'wp_get_current_user' ) + ->once() + ->andReturn( $this->admin_user ); + $this->notification_center ->expects( 'add_notification' ) ->once();