Changeset 12903 for trunk/tests/phpunit/testcases/core/optouts.php
- Timestamp:
- 04/21/2021 07:10:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/optouts.php
r12898 r12903 101 101 } 102 102 103 public function test_bp_optouts_get_by_email_address_mismatched_case() { 104 $old_current_user = get_current_user_id(); 105 106 $u1 = $this->factory->user->create(); 107 $this->set_current_user( $u1 ); 108 109 // Create a couple of optouts. 110 $args = array( 111 'email_address' => 'ONE@wpfrost.org', 112 'user_id' => $u1, 113 'email_type' => 'annoyance' 114 ); 115 $i1 = bp_add_optout( $args ); 116 $args['email_address'] = 'two@WP.org'; 117 $i2 = bp_add_optout( $args ); 118 119 $get_args = array( 120 'email_address' => 'one@WPfrost.org', 121 'fields' => 'ids', 122 ); 123 $optouts = bp_get_optouts( $get_args ); 124 $this->assertEqualSets( array( $i1 ), $optouts ); 125 126 $this->set_current_user( $old_current_user ); 127 } 128 129 public function test_bp_optouts_get_by_search_terms_mismatched_case() { 130 $old_current_user = get_current_user_id(); 131 132 $u1 = $this->factory->user->create(); 133 $this->set_current_user( $u1 ); 134 135 // Create a couple of optouts. 136 $args = array( 137 'email_address' => 'ONE@wpfrost.org', 138 'user_id' => $u1, 139 'email_type' => 'annoyance' 140 ); 141 $i1 = bp_add_optout( $args ); 142 $args['email_address'] = 'two@WP.org'; 143 $i2 = bp_add_optout( $args ); 144 145 $get_args = array( 146 'search_terms' => 'one@wpfrost.org', 147 'fields' => 'ids', 148 ); 149 $optouts = bp_get_optouts( $get_args ); 150 $this->assertEqualSets( array( $i1 ), $optouts ); 151 152 $this->set_current_user( $old_current_user ); 153 } 154 155 156 public function test_bp_optouts_get_by_email_address_mismatched_case_after_update() { 157 $old_current_user = get_current_user_id(); 158 159 $u1 = $this->factory->user->create(); 160 $this->set_current_user( $u1 ); 161 162 // Create an opt-out. 163 $args = array( 164 'email_address' => 'ONE@wpfrost.org', 165 'user_id' => $u1, 166 'email_type' => 'annoyance' 167 ); 168 $i1 = bp_add_optout( $args ); 169 // Update it. 170 $oo_class = new BP_Optout( $i1 ); 171 $oo_class->email_address = 'One@wpFrost.org'; 172 $oo_class->save(); 173 174 $get_args = array( 175 'email_address' => 'one@WPfrost.org', 176 'fields' => 'ids', 177 ); 178 $optouts = bp_get_optouts( $get_args ); 179 $this->assertEqualSets( array( $i1 ), $optouts ); 180 181 $this->set_current_user( $old_current_user ); 182 } 183 103 184 }
Note: See TracChangeset
for help on using the changeset viewer.