Skip to content

Commit

Permalink
fix: remove ff constant
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenn00dle committed Nov 25, 2024
1 parent 5488146 commit c09ba1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
* Main class.
*/
class WooCommerce_Subscriptions {
/**
* Feature flag for the Newspack Subscriptions Expiration feature.
*/
const NEWSPACK_SUBSCRIPTIONS_EXPIRATION_FEATURE_FLAG = 'NEWSPACK_SUBSCRIPTIONS_EXPIRATION';

/**
* Initialize hooks and filters.
*/
Expand Down Expand Up @@ -46,7 +41,7 @@ public static function is_active() {
* @return bool
*/
public static function is_enabled() {
return Reader_Activation::is_enabled() && defined( self::NEWSPACK_SUBSCRIPTIONS_EXPIRATION_FEATURE_FLAG );
return Reader_Activation::is_enabled() && defined( 'NEWSPACK_SUBSCRIPTIONS_EXPIRATION' ) && NEWSPACK_SUBSCRIPTIONS_EXPIRATION;
}
}
WooCommerce_Subscriptions::init();
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Newspack_Test_Subscriptions_Meta extends WP_UnitTestCase {
* Setup for the tests.
*/
public function set_up() {
define( WooCommerce_Subscriptions::NEWSPACK_SUBSCRIPTIONS_EXPIRATION_FEATURE_FLAG, true );
define( 'NEWSPACK_SUBSCRIPTIONS_EXPIRATION', true );
WooCommerce_Subscriptions::init();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ public function test_is_active() {

/**
* Test WooCommerce_Subscriptions::is_enabled.
*
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function test_is_enabled() {
$is_active = WooCommerce_Subscriptions::is_enabled();
$this->assertFalse( $is_active, 'WooCommerce Subscriptions integration should be disabled when Feature Flag is not present.' );
define( WooCommerce_Subscriptions::NEWSPACK_SUBSCRIPTIONS_EXPIRATION_FEATURE_FLAG, true );
define( 'NEWSPACK_SUBSCRIPTIONS_EXPIRATION', true );
$is_active = WooCommerce_Subscriptions::is_enabled();
$this->assertTrue( $is_active, 'WooCommerce Subscriptions integration should be enabled when Feature Flag is present.' );
}
Expand Down

0 comments on commit c09ba1b

Please sign in to comment.