Changeset 47279 for trunk/tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php
- Timestamp:
- 02/11/2020 09:41:26 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php
r47246 r47279 208 208 } 209 209 210 /** 211 * The email headers should be filterable. 212 * 213 * @since 5.4.0 214 * 215 * @ticket 44501 216 */ 217 public function test_email_headers_should_be_filterable() { 218 $email = 'export.request.from.unregistered.user@example.com'; 219 $request_id = wp_create_user_request( $email, 'export_personal_data' ); 220 221 _wp_privacy_account_request_confirmed( $request_id ); 222 223 add_filter( 'user_request_confirmed_email_headers', array( $this, 'modify_email_headers' ) ); 224 _wp_privacy_send_request_confirmation_notification( $request_id ); 225 remove_filter( 'user_request_confirmed_email_headers', array( $this, 'modify_email_headers' ) ); 226 227 $mailer = tests_retrieve_phpmailer_instance(); 228 229 $this->assertContains( 'From: Tester <tester@example.com>', $mailer->get_sent()->header ); 230 } 231 232 /** 233 * Filter callback that modifies the headers of the user request confirmation email. 234 * 235 * @since 5.4.0 236 * 237 * @param string|array $headers The email headers. 238 * @return array $headers The new email headers. 239 */ 240 public function modify_email_headers( $headers ) { 241 $headers = array( 242 'From: Tester <tester@example.com>', 243 ); 244 245 return $headers; 246 } 247 210 248 }
Note: See TracChangeset
for help on using the changeset viewer.