diff --git a/modules/ppcp-onboarding/src/Helper/OnboardingUrl.php b/modules/ppcp-onboarding/src/Helper/OnboardingUrl.php index 9d4c9aa74..881d4295f 100644 --- a/modules/ppcp-onboarding/src/Helper/OnboardingUrl.php +++ b/modules/ppcp-onboarding/src/Helper/OnboardingUrl.php @@ -346,10 +346,7 @@ class OnboardingUrl { * @return void */ public function delete(): void { - $cache_key = $this->cache_key(); - if ( $this->cache->has( $cache_key ) ) { - $this->cache->delete( $cache_key ); - } + $this->cache->delete( $this->cache_key() ); } /** diff --git a/tests/PHPUnit/Onboarding/Helper/OnboardingUrlTest.php b/tests/PHPUnit/Onboarding/Helper/OnboardingUrlTest.php index 8967e9a56..ea8b0ab0e 100644 --- a/tests/PHPUnit/Onboarding/Helper/OnboardingUrlTest.php +++ b/tests/PHPUnit/Onboarding/Helper/OnboardingUrlTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\Onboarding\Helper; -use PHPUnit\Framework\TestCase; +use WooCommerce\PayPalCommerce\TestCase; use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache; use RuntimeException; use function Brain\Monkey\Functions\when; @@ -15,7 +15,7 @@ class OnboardingUrlTest extends TestCase private $user_id = 123; private $onboardingUrl; - protected function setUp(): void + public function setUp(): void { parent::setUp(); @@ -118,7 +118,6 @@ class OnboardingUrlTest extends TestCase public function test_delete() { // Expectations - $this->cache->shouldReceive('has')->once(); $this->cache->shouldReceive('delete')->once(); $this->onboardingUrl->delete();