Skip to content

Commit

Permalink
Fix another unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pls78 committed Oct 26, 2023
1 parent 671c37a commit 40cf598
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 40cf598

Please sign in to comment.