Changeset 60253 for trunk/tests/phpunit/tests/customize/setting.php
- Timestamp:
- 05/26/2025 02:34:12 PM (13 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/customize/setting.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/setting.php
r57920 r60253 17 17 */ 18 18 public $undefined; 19 20 /** 21 * Shared admin user ID for the tests. 22 * 23 * @var int 24 */ 25 public static $admin_id = 0; 26 27 /** 28 * Set up shared fixtures. 29 * 30 * @param WP_UnitTest_Factory $factory Factory. 31 */ 32 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 33 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 34 } 19 35 20 36 public function set_up() { … … 138 154 */ 139 155 public function test_preview_standard_types_non_multidimensional() { 140 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));156 wp_set_current_user( self::$admin_id ); 141 157 $_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) ); 142 158 … … 217 233 */ 218 234 public function test_preview_standard_types_multidimensional() { 219 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));235 wp_set_current_user( self::$admin_id ); 220 236 $_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) ); 221 237 … … 363 379 */ 364 380 public function test_preview_custom_type() { 365 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));381 wp_set_current_user( self::$admin_id ); 366 382 $type = 'custom_type'; 367 383 $post_data_overrides = array( … … 514 530 515 531 // Satisfy all requirements for save to happen. 516 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));532 wp_set_current_user( self::$admin_id ); 517 533 $this->assertNotFalse( $setting->save() ); 518 534 $this->assertTrue( 1 === did_action( 'customize_update_custom' ) ); … … 552 568 */ 553 569 public function test_is_current_blog_previewed() { 554 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));570 wp_set_current_user( self::$admin_id ); 555 571 $type = 'option'; 556 572 $name = 'blogname'; … … 574 590 */ 575 591 public function test_previewing_with_switch_to_blog() { 576 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));592 wp_set_current_user( self::$admin_id ); 577 593 $type = 'option'; 578 594 $name = 'blogdescription'; … … 597 613 public function test_option_autoloading() { 598 614 global $wpdb; 599 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));615 wp_set_current_user( self::$admin_id ); 600 616 601 617 $name = 'autoloaded1'; … … 744 760 */ 745 761 public function test_multidimensional_value_when_previewed() { 746 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));762 wp_set_current_user( self::$admin_id ); 747 763 WP_Customize_Setting::reset_aggregated_multidimensionals(); 748 764
Note: See TracChangeset
for help on using the changeset viewer.