Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Features: Add the edge-rules feature for paid Business and Commerce plans.
31 changes: 31 additions & 0 deletions projects/plugins/wpcomsh/tests/WpcomFeaturesMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,37 @@ public static function woo_bundle_extensions_plan_provider() {
);
}

/**
* Catches a map entry widened to WPCOM_BUSINESS_PLANS, which would also grant the trials and Student.
*
* @dataProvider edge_rules_plan_provider
* @param string $slug Product slug.
* @param bool $expected Whether the plan grants Edge Rules.
*/
#[DataProvider( 'edge_rules_plan_provider' )]
public function test_edge_rules_needs_a_paid_business_or_commerce_plan( $slug, $expected ) {
$purchases = array( $this->purchase( $slug ) );

$this->assertSame( $expected, WPCOM_Features::has_feature( WPCOM_Features::EDGE_RULES, $purchases, 'wpcom' ) );
}

/**
* Plans checked for Edge Rules.
*
* @return array
*/
public static function edge_rules_plan_provider() {
return array(
'business' => array( 'business-bundle', true ),
'commerce' => array( 'ecommerce-bundle', true ),
'premium' => array( 'value_bundle', false ),
'pro' => array( 'pro-plan', false ),
'hosting trial' => array( 'wp_bundle_hosting_trial_monthly', false ),
'commerce trial' => array( 'ecommerce-trial-bundle-monthly', false ),
'student' => array( 'wp_bundle_student_yearly', false ),
);
}

public function test_sticker_not_present_withdraws_the_definition_once_the_sticker_lands() {
$map = array(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ class WPCOM_Features {
public const ECOMMERCE_MANAGED_PLUGINS_SMALL = 'ecommerce-managed-plugins-small';
public const ECOMMERCE_MANAGED_PLUGINS_MEDIUM = 'ecommerce-managed-plugins-medium';
public const ECOMMERCE_MANAGED_PLUGINS_TRIAL = 'ecommerce-managed-plugins-trial';
public const EDGE_RULES = 'edge-rules';
public const EDIT_PLUGINS = 'edit-plugins';
public const EDIT_THEMES = 'edit-themes';
public const EMAIL_PROFESSIONAL = 'email-professional';
Expand Down Expand Up @@ -872,6 +873,9 @@ class WPCOM_Features {
self::ECOMMERCE_MANAGED_PLUGINS_TRIAL => array(
self::WPCOM_ECOMMERCE_TRIAL_PLANS,
),
self::EDGE_RULES => array(
self::WPCOM_PAID_BUSINESS_AND_COMMERCE_PLANS,
),
// EDIT_PLUGINS - Provides the edit_plugins capability on atomic sites, does nothing on simple sites.
self::EDIT_PLUGINS => array(
self::WPCOM_PRO_PLANS,
Expand Down
Loading