Skip to content

Commit

Permalink
Fix failing tests after the hotfix (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan authored Nov 11, 2024
1 parent 9b2e5f5 commit 9c12b1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions Tests/Unit/inc/classes/ImagifyUser/getError.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public function testShouldReturnFromCachedUserDataIfAvailable() {
];

Functions\when( 'get_transient' )->justReturn( $userData );
Functions\expect( 'get_imagify_user' )->never();
Functions\when( 'set_transient')->justReturn();

$this->assertSame( '[email protected]', ( new User() )->email );
}
Expand All @@ -69,9 +67,7 @@ public function testShouldReturnFromCachedUserDataIfAvailable() {
public function testShouldReturnErrorWhenCouldNotFetchUserData() {
$wp_error = new WP_Error( 'error_id', 'Error Message' );

Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $wp_error );
Functions\when( 'set_transient')->justReturn();
Functions\when( 'get_transient' )->justReturn( $wp_error );

$this->assertSame( $wp_error, ( new User() )->get_error() );
}
Expand Down
1 change: 1 addition & 0 deletions Tests/bootstrap-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function init_test_suite( $test_suite = 'Unit' ) {

// Load Patchwork before everything else in order to allow us to redefine WordPress, 3rd party, and plugin's functions.
require_once IMAGIFY_PLUGIN_ROOT . '/vendor/antecedent/patchwork/Patchwork.php';
require_once IMAGIFY_PLUGIN_ROOT . '/inc/functions/api.php';
}

/**
Expand Down

0 comments on commit 9c12b1a

Please sign in to comment.