- Timestamp:
- 05/19/2016 08:50:46 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/class-bp-email-recipient.php
r10470 r10792 48 48 } 49 49 50 public function test_return_with_ address_and_optional_name() {50 public function test_return_with_known_address_and_optional_name() { 51 51 $email = 'test@example.com'; 52 $name = 'Custom'; 53 $recipient = new BP_Email_Recipient( $email, $name ); 54 55 $this->assertSame( 'test@example.com', $recipient->get_address() ); 56 $this->assertSame( 'Custom', $recipient->get_name() ); 57 } 58 59 public function test_return_with_known_address_and_empty_name() { 60 $email = 'test@example.com'; 61 $recipient = new BP_Email_Recipient( $email ); 62 63 $this->assertSame( 'test@example.com', $recipient->get_address() ); 64 65 // Should fallback to WP user name. 66 $this->assertSame( 'Unit Test', $recipient->get_name() ); 67 } 68 69 public function test_return_with_unknown_address_and_optional_name() { 70 $email = 'unknown@example.com'; 71 $name = 'Custom'; 72 $recipient = new BP_Email_Recipient( $email, $name ); 73 74 $this->assertSame( $email, $recipient->get_address() ); 75 $this->assertSame( $name, $recipient->get_name() ); 76 } 77 78 public function test_return_with_unknown_address_and_empty_name() { 79 $email = 'unknown@example.com'; 52 80 $recipient = new BP_Email_Recipient( $email ); 53 81 … … 56 84 } 57 85 58 public function test_return_with_array_and_optional_name() { 86 public function test_return_with_unknown_array_and_optional_name() { 87 $email = 'unknown@example.com'; 88 $name = 'Custom'; 89 $recipient = new BP_Email_Recipient( array( $email => $name ) ); 90 91 $this->assertSame( $email, $recipient->get_address() ); 92 $this->assertSame( $name, $recipient->get_name() ); 93 } 94 95 public function test_return_with_unknown_array_and_empty_name() { 96 $email = 'unknown@example.com'; 97 $recipient = new BP_Email_Recipient( array( $email ) ); 98 99 $this->assertSame( $email, $recipient->get_address() ); 100 $this->assertEmpty( $recipient->get_name() ); 101 } 102 103 public function test_return_with_known_array_and_optional_name() { 104 $email = 'test@example.com'; 105 $name = 'Custom'; 106 $recipient = new BP_Email_Recipient( array( $email => $name ) ); 107 108 $this->assertSame( $email, $recipient->get_address() ); 109 $this->assertSame( $name, $recipient->get_name() ); 110 } 111 112 public function test_return_with_known_array_and_empty_name() { 59 113 $email = 'test@example.com'; 60 114 $recipient = new BP_Email_Recipient( array( $email ) ); 61 115 62 116 $this->assertSame( $email, $recipient->get_address() ); 63 $this->assertEmpty( $recipient->get_name() ); 117 118 // Should fallback to WP user name. 119 $this->assertSame( 'Unit Test', $recipient->get_name() ); 64 120 } 65 121
Note: See TracChangeset
for help on using the changeset viewer.