- Timestamp:
- 04/03/2024 09:29:13 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/option/wpSetOptionAutoloadValues.php
r56559 r57920 31 31 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 32 32 $this->assertSame( $num_queries + 2, get_num_queries(), 'Function made unexpected amount of database queries' ); 33 $this->assertSame( array( ' yes', 'yes' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );33 $this->assertSame( array( 'on', 'on' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 34 34 foreach ( $options as $option => $autoload ) { 35 35 $this->assertFalse( wp_cache_get( $option, 'options' ), sprintf( 'Option %s not deleted from individual cache', $option ) ); … … 62 62 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 63 63 $this->assertSame( $num_queries + 2, get_num_queries(), 'Function made unexpected amount of database queries' ); 64 $this->assertSame( array( ' no', 'no' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );64 $this->assertSame( array( 'off', 'off' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 65 65 foreach ( $options as $option => $autoload ) { 66 66 $this->assertArrayNotHasKey( $option, wp_cache_get( 'alloptions', 'options' ), sprintf( 'Option %s not deleted from alloptions cache', $option ) ); … … 90 90 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 91 91 $this->assertSame( $num_queries + 1, get_num_queries(), 'Function made unexpected amount of database queries' ); 92 $this->assertSame( array( ' yes', 'yes' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );92 $this->assertSame( array( 'on', 'on' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 93 93 foreach ( $options as $option => $autoload ) { 94 94 $this->assertArrayHasKey( $option, wp_cache_get( 'alloptions', 'options' ), sprintf( 'Option %s unexpectedly deleted from alloptions cache', $option ) ); … … 125 125 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 126 126 $this->assertSame( $num_queries + 3, get_num_queries(), 'Function made unexpected amount of database queries' ); 127 $this->assertSameSets( array( ' yes', 'no', 'yes' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );127 $this->assertSameSets( array( 'on', 'off', 'on' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 128 128 foreach ( $options as $option => $autoload ) { 129 129 $this->assertFalse( wp_cache_get( $option, 'options' ), sprintf( 'Option %s not deleted from individual cache', $option ) ); … … 159 159 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 160 160 $this->assertSame( $num_queries + 2, get_num_queries(), 'Function made unexpected amount of database queries' ); 161 $this->assertSameSets( array( ' yes', 'no', 'yes' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );161 $this->assertSameSets( array( 'on', 'off', 'on' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 162 162 foreach ( $options as $option => $autoload ) { 163 163 if ( 'no' === $autoload ) { … … 200 200 201 201 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 202 $this->assertSame( array( ' no', 'no' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );202 $this->assertSame( array( 'off', 'off' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 203 203 } 204 204 … … 225 225 $this->assertSame( $expected, wp_set_option_autoload_values( $options ), 'Function produced unexpected result' ); 226 226 $this->assertSame( $num_queries + 3, get_num_queries(), 'Function made unexpected amount of database queries' ); 227 $this->assertSameSets( array( ' yes', 'no' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' );227 $this->assertSameSets( array( 'on', 'off' ), $wpdb->get_col( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name IN (" . implode( ',', array_fill( 0, count( $options ), '%s' ) ) . ')', ...array_keys( $options ) ) ), 'Option autoload values not updated in database' ); 228 228 } 229 229
Note: See TracChangeset
for help on using the changeset viewer.