From 9c12b1a89c098e98a3e1d83cd2a4db889deb192d Mon Sep 17 00:00:00 2001 From: WordPress Fan <146129302+wordpressfan@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:17:39 +0300 Subject: [PATCH] Fix failing tests after the hotfix (#918) --- Tests/Unit/inc/classes/ImagifyUser/getError.php | 6 +----- Tests/bootstrap-functions.php | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Tests/Unit/inc/classes/ImagifyUser/getError.php b/Tests/Unit/inc/classes/ImagifyUser/getError.php index def6526d..9c1b8060 100644 --- a/Tests/Unit/inc/classes/ImagifyUser/getError.php +++ b/Tests/Unit/inc/classes/ImagifyUser/getError.php @@ -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( 'imagify@example.com', ( new User() )->email ); } @@ -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() ); } diff --git a/Tests/bootstrap-functions.php b/Tests/bootstrap-functions.php index 131efc07..7e8f12f3 100644 --- a/Tests/bootstrap-functions.php +++ b/Tests/bootstrap-functions.php @@ -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'; } /**