Changeset 53767 for trunk/tests/phpunit/tests/cache.php
- Timestamp:
- 07/23/2022 02:56:51 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/cache.php
r53763 r53767 128 128 // If there is no value get returns false. 129 129 $this->assertFalse( $this->cache->get( $key ) ); 130 } 131 132 /** 133 * @ticket 4476 134 * @ticket 9773 135 * 136 * @covers ::wp_cache_flush_group 137 */ 138 public function test_wp_cache_flush_group() { 139 $key = 'my-key'; 140 $val = 'my-val'; 141 142 wp_cache_set( $key, $val, 'group-test' ); 143 wp_cache_set( $key, $val, 'group-kept' ); 144 145 $this->assertSame( $val, wp_cache_get( $key, 'group-test' ), 'group-test should contain my-val' ); 146 147 if ( wp_using_ext_object_cache() ) { 148 $this->setExpectedIncorrectUsage( 'wp_cache_flush_group' ); 149 } 150 151 $results = wp_cache_flush_group( 'group-test' ); 152 153 if ( wp_using_ext_object_cache() ) { 154 $this->assertFalse( $results ); 155 } else { 156 $this->assertTrue( $results ); 157 $this->assertFalse( wp_cache_get( $key, 'group-test' ), 'group-test should return false' ); 158 $this->assertSame( $val, wp_cache_get( $key, 'group-kept' ), 'group-kept should still contain my-val' ); 159 } 130 160 } 131 161 … … 416 446 $this->assertSame( $expected, $found ); 417 447 } 418 419 /**420 * @ticket 4476421 * @ticket 9773422 *423 * test wp_cache_flush_group424 *425 * @covers ::wp_cache_flush_group426 */427 public function test_wp_cache_flush_group() {428 $key = 'my-key';429 $val = 'my-val';430 431 wp_cache_set( $key, $val, 'group-test' );432 wp_cache_set( $key, $val, 'group-kept' );433 434 $this->assertSame( $val, wp_cache_get( $key, 'group-test' ), 'test_wp_cache_flush_group: group-test should contain my-val' );435 436 if ( wp_using_ext_object_cache() ) {437 $this->setExpectedIncorrectUsage( 'wp_cache_flush_group' );438 }439 440 $results = wp_cache_flush_group( 'group-test' );441 442 if ( wp_using_ext_object_cache() ) {443 $this->assertFalse( $results );444 } else {445 $this->assertTrue( $results );446 $this->assertFalse( wp_cache_get( $key, 'group-test' ), 'test_wp_cache_flush_group: group-test should return false' );447 $this->assertSame( $val, wp_cache_get( $key, 'group-kept' ), 'test_wp_cache_flush_group: group-kept should still contain my-val' );448 }449 }450 448 }
Note: See TracChangeset
for help on using the changeset viewer.