Added support for creating default integrations

This commit is contained in:
Christopher Allford 2020-01-08 21:05:14 -08:00
parent 300064187b
commit a477f9367d
2 changed files with 13 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class WC_Integrations {
do_action( 'woocommerce_integrations_init' );
$load_integrations = apply_filters( 'woocommerce_integrations', array() );
$load_integrations = apply_filters( 'woocommerce_integrations', $this->get_default_integrations() );
// Load integration classes.
foreach ( $load_integrations as $integration ) {
@ -48,4 +48,14 @@ class WC_Integrations {
public function get_integrations() {
return $this->integrations;
}
/**
* Fetches all of the default integrations.
*
* @return array
*/
private function get_default_integrations() {
$default_integrations = array();
return $default_integrations;
}
}

View File

@ -30,8 +30,8 @@ class WC_Tests_Integrations extends WC_Unit_Test_Case {
*/
public function test_filter() {
$integrations = new WC_Integrations();
$this->assertEquals( array(), $integrations->integrations );
$this->assertEquals( array(), $integrations->get_integrations() );
$this->assertArrayHasKey( 'woocommerce_maxmind_geolocation', $integrations->integrations );
$this->assertArrayHasKey( 'woocommerce_maxmind_geolocation', $integrations->get_integrations() );
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'class-dummy-integration.php';