Skip to content

Commit

Permalink
revert change
Browse files Browse the repository at this point in the history
  • Loading branch information
remyperona committed Oct 11, 2024
1 parent 8622d79 commit cb79e0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Tests/Unit/inc/classes/ImagifyUser/getError.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testShouldReturnFalseWhenFetchedUserData() {
'is_monthly' => true,
];

Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $userData );

$this->assertFalse( ( new User() )->get_error() );
Expand All @@ -55,7 +55,7 @@ public function testShouldReturnFromCachedUserDataIfAvailable() {
'is_monthly' => true,
];

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

$this->assertSame( '[email protected]', ( new User() )->email );
Expand All @@ -67,7 +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( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $wp_error );

$this->assertSame( $wp_error, ( new User() )->get_error() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Test_GetPercentConsumedQuota extends TestCase {
public function testShouldReturnZeroWhenCouldNotFetchUserData() {
$wp_error = new WP_Error( 'error_id', 'Error Message' );

Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $wp_error );
Functions\expect( 'imagify_round_half_five' )->never();

Expand All @@ -48,7 +48,7 @@ public function testShouldReturnQuotaWhenFetchedUserData() {
'is_monthly' => true,
];

Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $userData );
Functions\expect( 'imagify_round_half_five' )
->twice()
Expand All @@ -72,7 +72,7 @@ public function testShouldReturnQuotaWhenFetchedUserData() {

$userData->consumed_current_month_quota = 500; // Current consumed quota 50%.

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

$imagify_data_mock->shouldReceive( 'get' )
->never();
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/inc/classes/ImagifyUser/isOverQuota.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Test_IsOverQuota extends TestCase {
public function testShouldReturnFalseWhenCouldNotFetchUserData() {
$wp_error = new WP_Error( 'error_id', 'Error Message' );

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

$this->assertFalse( ( new User() )->is_over_quota() );
Expand All @@ -46,7 +46,7 @@ public function testShouldReturnFalseWhenPaidAccount() {
'is_monthly' => true,
];

Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $userData );

$this->assertFalse( ( new User() )->is_over_quota() );
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testShouldReturnTrueWhenFreeOverQuota() {
}

private function createMocks( $userData, $dataPreviousQuotaPercent ) {
Functions\when( 'get_transient' )->justReturn( false );
Functions\when( 'imagify_get_cached_user' )->justReturn( false );
Functions\when( 'get_imagify_user' )->justReturn( $userData );
Functions\expect( 'imagify_round_half_five' )
->once()
Expand Down

0 comments on commit cb79e0d

Please sign in to comment.