Changeset 13905
- Timestamp:
- 06/04/2024 10:47:30 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-email.php
r13892 r13905 197 197 $this->set_from( $from_address, $from_name ); 198 198 $this->set_reply_to( bp_get_option( 'admin_email' ), $from_name ); 199 200 // Prefer HTML emails unless filtered to plaintext. 201 $this->set_content_type( $this->content_type ); 199 202 200 203 /** -
trunk/tests/phpunit/testcases/core/class-bp-email.php
r13314 r13905 30 30 } 31 31 32 /** 33 * @ticket BP9169 34 */ 35 public function test_default_content_type() { 36 $email = new BP_Email( 'activity-at-message' ); 37 38 $this->assertSame( 'html', $email->get_content_type() ); 39 } 40 41 /** 42 * @ticket BP9169 43 */ 44 public function test_set_content_type_to_plaintext() { 45 $email = new BP_Email( 'activity-at-message' ); 46 $email->set_content_type( 'plaintext' ); 47 48 $this->assertSame( 'plaintext', $email->get_content_type() ); 49 } 50 51 /** 52 * @ticket BP9169 53 */ 54 public function test_set_content_type_to_plaintext_via_filter() { 55 add_filter( 'bp_email_set_content_type', array( $this, 'bp_disable_html_emails' ) ); 56 $email = new BP_Email( 'activity-at-message' ); 57 remove_filter( 'bp_email_set_content_type', array( $this, 'bp_disable_html_emails' ) ); 58 59 $this->assertSame( 'plaintext', $email->get_content_type() ); 60 } 61 public function bp_disable_html_emails( $content_type ) { 62 return 'plaintext'; 63 } 64 32 65 public function test_valid_html_content() { 33 66 $message = '<b>test</b>'; … … 48 81 49 82 $this->assertSame( $message, $email->get_content() ); 83 } 84 85 /** 86 * @ticket BP9169 87 */ 88 public function test_plaintext_strip_tags() { 89 $message = '<b>test</b>'; 90 $plainmsg = 'test'; 91 $email = new BP_Email( 'activity-at-message' ); 92 93 $email->set_content_plaintext( $message ); 94 $email->set_content_type( 'plaintext' ); 95 96 $this->assertSame( $plainmsg, $email->get_content() ); 50 97 } 51 98
Note: See TracChangeset
for help on using the changeset viewer.