♻️ Update tests to use the new Enum

This commit is contained in:
Philipp Stracker 2025-03-21 18:16:41 +01:00
parent ba122714d8
commit ed3c6799d0
No known key found for this signature in database
2 changed files with 7 additions and 6 deletions

View file

@ -5,7 +5,7 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Helper;
use PHPUnit\Framework\TestCase;
use WooCommerce\PayPalCommerce\Settings\Service\BrandedExperience\ActivationDetector;
use WooCommerce\PayPalCommerce\Settings\Enum\InstallationPathEnum;
use function Brain\Monkey\Functions\when;
use function Brain\Monkey\Functions\expect;
use function Brain\Monkey\setUp;
@ -29,8 +29,8 @@ class PartnerAttributionTest extends TestCase {
* @var array
*/
private array $bn_codes = array(
ActivationDetector::CORE_PROFILER => 'WooPPCP_Ecom_PS_CoreProfiler',
ActivationDetector::PAYMENT_SETTINGS => 'WooPPCP_Ecom_PS_CoreProfiler',
InstallationPathEnum::CORE_PROFILER => 'WooPPCP_Ecom_PS_CoreProfiler',
InstallationPathEnum::PAYMENT_SETTINGS => 'WooPPCP_Ecom_PS_CoreProfiler',
);
/**

View file

@ -4,6 +4,7 @@ declare( strict_types=1 );
namespace PHPUnit\Settings\Service\BrandedExperience;
use WooCommerce\PayPalCommerce\Settings\Service\BrandedExperience\ActivationDetector;
use WooCommerce\PayPalCommerce\Settings\Enum\InstallationPathEnum;
use WooCommerce\PayPalCommerce\TestCase;
use function Brain\Monkey\Functions\expect;
use function Brain\Monkey\Functions\when;
@ -14,7 +15,7 @@ class ActivationDetectorTest extends TestCase {
when( 'get_option' )->justReturn( [] );
$detector = new ActivationDetector();
$this->assertEquals( ActivationDetector::DIRECT, $detector->detect_activation_path() );
$this->assertEquals( InstallationPathEnum::DIRECT, $detector->detect_activation_path() );
}
public function test_returns_core_profiler_if_attached_via_core_profiler() {
@ -28,7 +29,7 @@ class ActivationDetectorTest extends TestCase {
$detector = new ActivationDetector();
$this->assertEquals( ActivationDetector::CORE_PROFILER, $detector->detect_activation_path() );
$this->assertEquals( InstallationPathEnum::CORE_PROFILER, $detector->detect_activation_path() );
}
public function test_returns_payment_settings_if_attached_via_payments_settings_page() {
@ -46,6 +47,6 @@ class ActivationDetectorTest extends TestCase {
$detector = new ActivationDetector();
$this->assertEquals( ActivationDetector::PAYMENT_SETTINGS, $detector->detect_activation_path() );
$this->assertEquals( InstallationPathEnum::PAYMENT_SETTINGS, $detector->detect_activation_path() );
}
}