- Timestamp:
- 10/26/2023 10:54:15 PM (14 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/option/wpPrimeOptionCachesByGroup.php
r57012 r57013 1 1 <?php 2 2 /** 3 * Test wp_ load_options_by_group().3 * Test wp_prime_option_caches_by_group(). 4 4 * 5 5 * @group option 6 6 * 7 * @covers ::wp_ load_options_by_group7 * @covers ::wp_prime_option_caches_by_group 8 8 */ 9 class Tests_Option_ PrimeOptionsByGroup extends WP_UnitTestCase {9 class Tests_Option_WpPrimeOptionCachesByGroup extends WP_UnitTestCase { 10 10 11 11 /** 12 * Tests that wp_ load_options_by_group() only loads options in the specified group.12 * Tests that wp_prime_option_caches_by_group() only primes options in the specified group. 13 13 * 14 14 * @ticket 58962 15 15 */ 16 public function test_wp_ load_options_by_group() {16 public function test_wp_prime_option_caches_by_group() { 17 17 global $new_allowed_options; 18 18 19 // Create some options to load.19 // Create some options to prime. 20 20 $new_allowed_options = array( 21 21 'group1' => array( … … 28 28 ); 29 29 30 $options_to_ load= array(30 $options_to_prime = array( 31 31 'option1', 32 32 'option2', … … 39 39 * check options are not in cache initially. 40 40 */ 41 foreach ( $options_to_ loadas $option ) {41 foreach ( $options_to_prime as $option ) { 42 42 update_option( $option, "value_$option", false ); 43 43 wp_cache_delete( $option, 'options' ); … … 45 45 } 46 46 47 // Call the wp_ load_options_by_group function to loadthe options.48 wp_ load_options_by_group( 'group1' );47 // Call the wp_prime_option_caches_by_group function to prime the options. 48 wp_prime_option_caches_by_group( 'group1' ); 49 49 50 50 // Check that options are now in the cache. 51 $this->assertSame( get_option( 'option1' ), wp_cache_get( 'option1', 'options' ), 'option1 was not loaded.' );52 $this->assertSame( get_option( 'option2' ), wp_cache_get( 'option2', 'options' ), 'option2 was not loaded.' );51 $this->assertSame( get_option( 'option1' ), wp_cache_get( 'option1', 'options' ), 'option1\'s cache was not primed.' ); 52 $this->assertSame( get_option( 'option2' ), wp_cache_get( 'option2', 'options' ), 'option2\'s cache was not primed.' ); 53 53 54 54 // Make sure option3 is still not in cache. … … 57 57 58 58 /** 59 * Tests wp_ load_options_by_group() with a nonexistent option group.59 * Tests wp_prime_option_caches_by_group() with a nonexistent option group. 60 60 * 61 61 * @ticket 58962 62 62 */ 63 public function test_wp_ load_options_by_group_with_nonexistent_group() {63 public function test_wp_prime_option_caches_by_group_with_nonexistent_group() { 64 64 // Make sure options are not in cache or database initially. 65 65 $this->assertFalse( wp_cache_get( 'option1', 'options' ), 'option1 was not deleted from the cache.' ); 66 66 $this->assertFalse( wp_cache_get( 'option2', 'options' ), 'option2 was not deleted from the cache.' ); 67 67 68 // Call the wp_ load_options_by_group function with a nonexistent group.69 wp_ load_options_by_group( 'nonexistent_group' );68 // Call the wp_prime_option_caches_by_group function with a nonexistent group. 69 wp_prime_option_caches_by_group( 'nonexistent_group' ); 70 70 71 71 // Check that options are still not in the cache or database.
Note: See TracChangeset
for help on using the changeset viewer.