Unregister all channels on test tear down
This commit is contained in:
parent
130b2a94c6
commit
4d6ef8ece3
|
@ -26,6 +26,11 @@ class MarketingCampaignsTest extends WC_REST_Unit_Test_Case {
|
|||
*/
|
||||
const ENDPOINT = '/wc-admin/marketing/campaigns';
|
||||
|
||||
/**
|
||||
* @var MarketingChannelsService
|
||||
*/
|
||||
private $marketing_channels_service;
|
||||
|
||||
/**
|
||||
* Set up.
|
||||
*/
|
||||
|
@ -40,14 +45,17 @@ class MarketingCampaignsTest extends WC_REST_Unit_Test_Case {
|
|||
);
|
||||
wp_set_current_user( $this->user );
|
||||
|
||||
/**
|
||||
* MarketingChannels class.
|
||||
*
|
||||
* @var MarketingChannelsService $marketing_channels_service
|
||||
*/
|
||||
$this->marketing_channels_service = wc_get_container()->get( MarketingChannelsService::class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test teardown.
|
||||
*/
|
||||
public function tearDown(): void {
|
||||
$this->marketing_channels_service->unregister_all();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the marketing campaigns for all registered channels are aggregated and returned by the endpoint.
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,11 @@ class MarketingChannelsTest extends WC_REST_Unit_Test_Case {
|
|||
*/
|
||||
const ENDPOINT = '/wc-admin/marketing/channels';
|
||||
|
||||
/**
|
||||
* @var MarketingChannelsService
|
||||
*/
|
||||
private $marketing_channels_service;
|
||||
|
||||
/**
|
||||
* Set up.
|
||||
*/
|
||||
|
@ -39,14 +44,17 @@ class MarketingChannelsTest extends WC_REST_Unit_Test_Case {
|
|||
);
|
||||
wp_set_current_user( $this->user );
|
||||
|
||||
/**
|
||||
* MarketingChannels class.
|
||||
*
|
||||
* @var MarketingChannelsService $marketing_channels_service
|
||||
*/
|
||||
$this->marketing_channels_service = wc_get_container()->get( MarketingChannelsService::class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test teardown.
|
||||
*/
|
||||
public function tearDown(): void {
|
||||
$this->marketing_channels_service->unregister_all();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the registered marketing channels are returned by the endpoint.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue