-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle missing Mailchimp API key
- Loading branch information
Showing
3 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Class Newsletters Test Mailchimp Cached Data | ||
* | ||
* @package Newspack_Newsletters | ||
*/ | ||
|
||
/** | ||
* Tests the Mailchimp Cached Data Class. | ||
*/ | ||
class Newsletters_Mailchimp_Cached_Data_Test extends WP_UnitTestCase { | ||
/** | ||
* Setup. | ||
*/ | ||
public function set_up() { | ||
// Reset the API key. | ||
delete_option( 'newspack_mailchimp_api_key' ); | ||
} | ||
|
||
/** | ||
* Test the API setup. | ||
*/ | ||
public function test_mailchimp_cached_data_api_setup() { | ||
// This tests if an empty API key won't cause the code to error out. | ||
$segments = Newspack_Newsletters_Mailchimp_Cached_Data::fetch_segments( 'list1' ); | ||
$this->assertEquals( [], $segments ); | ||
} | ||
} |