Add tracking of .com ecommerce wpcom plan
[MAILPOET-5628]
This commit is contained in:
@ -40,6 +40,10 @@ class DotcomHelperFunctions {
|
|||||||
return function_exists('wc_calypso_bridge_is_ecommerce_trial_plan') && wc_calypso_bridge_is_ecommerce_trial_plan();
|
return function_exists('wc_calypso_bridge_is_ecommerce_trial_plan') && wc_calypso_bridge_is_ecommerce_trial_plan();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isEcommerceWPCom(): bool {
|
||||||
|
return function_exists('wc_calypso_bridge_is_wpcom_ecommerce_plan') && wc_calypso_bridge_is_wpcom_ecommerce_plan();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the plan name for the current site if hosted on WordPress.com.
|
* Returns the plan name for the current site if hosted on WordPress.com.
|
||||||
* Empty otherwise.
|
* Empty otherwise.
|
||||||
@ -47,20 +51,16 @@ class DotcomHelperFunctions {
|
|||||||
public function getDotcomPlan(): string {
|
public function getDotcomPlan(): string {
|
||||||
if ($this->isWooExpressPerformance()) {
|
if ($this->isWooExpressPerformance()) {
|
||||||
return 'performance';
|
return 'performance';
|
||||||
}
|
} elseif ($this->isWooExpressEssential()) {
|
||||||
|
|
||||||
if ($this->isWooExpressEssential()) {
|
|
||||||
return 'essential';
|
return 'essential';
|
||||||
}
|
} elseif ($this->isBusiness()) {
|
||||||
|
|
||||||
if ($this->isBusiness()) {
|
|
||||||
return 'business';
|
return 'business';
|
||||||
}
|
} elseif ($this->isEcommerceTrial()) {
|
||||||
|
|
||||||
if ($this->isEcommerceTrial()) {
|
|
||||||
return 'ecommerce_trial';
|
return 'ecommerce_trial';
|
||||||
}
|
} elseif ($this->isEcommerceWPCom()) {
|
||||||
|
return 'ecommerce_wpcom';
|
||||||
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,10 @@ class DotcomHelperFunctionsTest extends \MailPoetUnitTest {
|
|||||||
$dotcomHelper->method('isEcommerceTrial')->willReturn(true);
|
$dotcomHelper->method('isEcommerceTrial')->willReturn(true);
|
||||||
expect($dotcomHelper->getDotcomPlan())->equals('ecommerce_trial');
|
expect($dotcomHelper->getDotcomPlan())->equals('ecommerce_trial');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItReturnsEcommerceWPComIfEcommerceWPCom() {
|
||||||
|
$dotcomHelper = $this->createPartialMock(DotcomHelperFunctions::class, ['isEcommerceWPCom']);
|
||||||
|
$dotcomHelper->method('isEcommerceWPCom')->willReturn(true);
|
||||||
|
expect($dotcomHelper->getDotcomPlan())->equals('ecommerce_wpcom');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user