-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests/remove network dependent #3541
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,26 +51,6 @@ private static function get_test_email( $type ) { | |
* Email setup & defaults generation. | ||
*/ | ||
public function test_emails_setup() { | ||
self::assertEquals( | ||
Emails::get_emails( [ 'test-email-config' ] ), | ||
[], | ||
'Emails are empty until configured.' | ||
); | ||
self::assertFalse( | ||
Emails::can_send_email( 'test-email-config' ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we short circuit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not about |
||
'Test email cannot be sent.' | ||
); | ||
self::assertFalse( | ||
Emails::supports_emails(), | ||
'Emails are not configured until the Newspack Newsletters plugin is active.' | ||
); | ||
$send_result = Emails::send_email( | ||
'test-email-config', | ||
'[email protected]' | ||
); | ||
self::assertFalse( $send_result, 'Email cannot be sent until the instance is configured.' ); | ||
|
||
Plugin_Manager::activate( 'newspack-newsletters' ); | ||
self::assertTrue( | ||
Emails::supports_emails(), | ||
'Emails are configured after Newspack Newsletters plugin is active.' | ||
|
@@ -104,8 +84,6 @@ public function test_emails_setup() { | |
* Email sending, with a template. | ||
*/ | ||
public function test_emails_send_with_template() { | ||
Plugin_Manager::activate( 'newspack-newsletters' ); | ||
|
||
$test_email = self::get_test_email( 'test-email-config' ); | ||
|
||
$recipient = '[email protected]'; | ||
|
@@ -152,7 +130,6 @@ public function test_emails_send_with_template() { | |
* Sending by email id. | ||
*/ | ||
public function test_emails_send_by_id() { | ||
Plugin_Manager::activate( 'newspack-newsletters' ); | ||
$test_email = self::get_test_email( 'test-email-config' ); | ||
|
||
$send_result = Emails::send_email( | ||
|
@@ -172,7 +149,6 @@ public function test_emails_send_by_id() { | |
* Email post status handling. | ||
*/ | ||
public function test_emails_status() { | ||
Plugin_Manager::activate( 'newspack-newsletters' ); | ||
$test_email = self::get_test_email( 'test-email-config' ); | ||
wp_update_post( | ||
[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik, all these tests are not making any requests.
server->dispatch
is emulating the server receiving a requestThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the way to test Rest API endpoints without needing http requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about testing the REST API endpoints. The endpoint handler is making requests to the plugin repository to fetch plugin code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha