Skip to content

Commit

Permalink
Simplify implementation of configure method in VIP Integrations (#4921)
Browse files Browse the repository at this point in the history
Simplify implementation of configure method, and rectify incorrect test name for the is_loaded function
  • Loading branch information
ingeniumed authored Oct 9, 2023
1 parent f944772 commit 1c565b2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
5 changes: 0 additions & 5 deletions integrations/block-data-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,4 @@ public function load(): void {
}
} );
}

/**
* Configure `Block Data API` for VIP Platform.
*/
public function configure(): void {}
}
8 changes: 5 additions & 3 deletions integrations/integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,13 @@ abstract public function load(): void;

/**
* Configure the integration for VIP platform.
*
*
* If we want to implement functionality only if the integration is enabled via VIP
* then we will use this function.
*
*
* By default, the implementation of this function will be empty.
*
* @private
*/
abstract public function configure(): void;
public function configure(): void {}
}
5 changes: 0 additions & 5 deletions integrations/vip-governance.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,4 @@ public function load(): void {
}
} );
}

/**
* Configure `VIP Governance` for VIP Platform.
*/
public function configure(): void {}
}
2 changes: 1 addition & 1 deletion tests/integrations/test-vip-block-data-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function test__load_call_returns_inactive_because_no_block_data_api_plugi
$this->assertFalse( $block_data_api_integration->is_active() );
}

public function test__if_is_loaded_gives_back_true_when_loaded(): void {
public function test__if_is_loaded_gives_back_false_when_not_loaded(): void {
$block_data_api_integration = new BlockDataApiIntegration( $this->slug );

$this->assertFalse( $block_data_api_integration->is_loaded() );
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/test-vip-governance.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function test__load_call_returns_inactive_because_no_governance_plugin_lo
$this->assertFalse( $vip_governance_integration->is_active() );
}

public function test__if_is_loaded_gives_back_true_when_loaded(): void {
public function test__if_is_loaded_gives_back_false_when_not_loaded(): void {
$vip_governance_integration = new VipGovernanceIntegration( $this->slug );

$this->assertFalse( $vip_governance_integration->is_loaded() );
Expand Down
12 changes: 3 additions & 9 deletions vip-integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,21 @@

namespace Automattic\VIP\Integrations;

// @codeCoverageIgnoreStart -- the actual code here is tested individually in the unit tests.
defined( 'ABSPATH' ) || die();

// @codeCoverageIgnoreStart - the actual code here is tested individually in the unit tests.

require_once __DIR__ . '/integrations/integration.php';
require_once __DIR__ . '/integrations/integrations.php';
require_once __DIR__ . '/integrations/enums.php';
require_once __DIR__ . '/integrations/integration-vip-config.php';
require_once __DIR__ . '/integrations/block-data-api.php';
require_once __DIR__ . '/integrations/parsely.php';
require_once __DIR__ . '/integrations/vip-governance.php';

// Register VIP integrations here.
IntegrationsSingleton::instance()->register( new BlockDataApiIntegration( 'block-data-api' ) );
IntegrationsSingleton::instance()->register( new ParselyIntegration( 'parsely' ) );

// ToDo: Remove this after the initial deployment of the VIP Governance integration.
if ( file_exists( __DIR__ . '/integrations/vip-governance.php' ) ) {
require_once __DIR__ . '/integrations/vip-governance.php';
IntegrationsSingleton::instance()->register( new VipGovernanceIntegration( 'vip-governance' ) );
}

IntegrationsSingleton::instance()->register( new VipGovernanceIntegration( 'vip-governance' ) );
// @codeCoverageIgnoreEnd

/**
Expand Down

0 comments on commit 1c565b2

Please sign in to comment.