Changeset 13991 for trunk/tests/phpunit/testcases/core/optouts.php
- Timestamp:
- 07/27/2024 08:16:17 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/optouts.php
r13980 r13991 5 5 */ 6 6 class BP_Tests_Optouts extends BP_UnitTestCase { 7 8 /** 9 * @ticket BP8552 10 */ 11 public function test_bp_optouts_query_cache_results() { 12 global $wpdb; 13 14 self::factory()->optout->create_many( 2 ); 15 16 // Reset. 17 $wpdb->num_queries = 0; 18 19 $first_query = BP_Optout::get( 20 array( 'cache_results' => true ) 21 ); 22 23 $queries_before = get_num_queries(); 24 25 $second_query = BP_Optout::get( 26 array( 'cache_results' => false ) 27 ); 28 29 $queries_after = get_num_queries(); 30 31 $this->assertNotSame( $queries_before, $queries_after, 'Assert that queries are run' ); 32 $this->assertSame( 3, $queries_after, 'Assert that the uncached query was run' ); 33 $this->assertEquals( $first_query, $second_query, 'Results of the query are expected to match.' ); 34 } 35 7 36 public function test_bp_optouts_add_optout_vanilla() { 8 37 $old_current_user = get_current_user_id(); … … 17 46 'email_type' => 'annoyance' 18 47 ); 19 $i1 = bp_add_optout( $args );48 $i1 = self::factory()->optout->create( $args ); 20 49 $args['email_address'] = 'two@wp.org'; 21 $i2 = bp_add_optout( $args );50 $i2 = self::factory()->optout->create( $args ); 22 51 23 52 $get_args = array( … … 62 91 'email_type' => 'annoyance' 63 92 ); 64 $i1 = bp_add_optout( $args );93 $i1 = self::factory()->optout->create( $args ); 65 94 bp_delete_optout_by_id( $i1 ); 66 95 … … 70 99 ); 71 100 $optouts = bp_get_optouts( $get_args ); 72 $this->assert True( empty( $optouts ));101 $this->assertEmpty( $optouts ); 73 102 74 103 self::set_current_user( $old_current_user ); … … 87 116 'email_type' => 'annoyance' 88 117 ); 89 $i1 = bp_add_optout( $args );118 $i1 = self::factory()->optout->create( $args ); 90 119 $args['email_address'] = 'two@wp.org'; 91 $i2 = bp_add_optout( $args );120 self::factory()->optout->create( $args ); 92 121 93 122 $get_args = array( … … 113 142 'email_type' => 'annoyance' 114 143 ); 115 $i1 = bp_add_optout( $args );144 $i1 = self::factory()->optout->create( $args ); 116 145 $args['email_address'] = 'two@WP.org'; 117 $i2 = bp_add_optout( $args );146 self::factory()->optout->create( $args ); 118 147 119 148 $get_args = array( … … 139 168 'email_type' => 'annoyance' 140 169 ); 141 $i1 = bp_add_optout( $args );170 $i1 = self::factory()->optout->create( $args ); 142 171 $args['email_address'] = 'two@WP.org'; 143 $i2 = bp_add_optout( $args );172 self::factory()->optout->create( $args ); 144 173 145 174 $get_args = array( … … 166 195 'email_type' => 'annoyance' 167 196 ); 168 $i1 = bp_add_optout( $args );197 $i1 = self::factory()->optout->create( $args ); 169 198 // Update it. 170 199 $oo_class = new BP_Optout( $i1 ); … … 193 222 'email_type' => 'annoyance' 194 223 ); 195 $i1 = bp_add_optout( $args );224 self::factory()->optout->create( $args ); 196 225 $email = new BP_Email( 'activity-at-message' ); 197 226 $email->set_from( 'test1@example.com' )->set_to( 'test2@example.com' )->set_subject( 'testing' );
Note: See TracChangeset
for help on using the changeset viewer.