- Timestamp:
- 05/26/2025 02:34:12 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/selective-refresh-ajax.php
r56971 r60253 30 30 31 31 /** 32 * Shared user ID for the tests. 33 * 34 * @var int 35 */ 36 public static $user_id = 0; 37 38 /** 39 * Set up shared fixtures. 40 * 41 * @param WP_UnitTest_Factory $factory Factory. 42 */ 43 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 44 self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) ); 45 } 46 47 /** 32 48 * Set up the test fixture. 33 49 */ … … 80 96 81 97 // Check expected_customize_preview. 82 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));98 wp_set_current_user( self::$user_id ); 83 99 $_REQUEST['nonce'] = wp_create_nonce( 'preview-customize_' . $this->wp_customize->theme()->get_stylesheet() ); 84 100 ob_start(); … … 122 138 */ 123 139 private function setup_valid_render_partials_request_environment() { 124 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));140 wp_set_current_user( self::$user_id ); 125 141 $_REQUEST['nonce'] = wp_create_nonce( 'preview-customize_' . $this->wp_customize->theme()->get_stylesheet() ); 126 142 $_POST[ WP_Customize_Selective_Refresh::RENDER_QUERY_VAR ] = '1'; … … 172 188 public function test_handle_render_partials_request_for_non_rendering_partial() { 173 189 $this->setup_valid_render_partials_request_environment(); 174 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));190 wp_set_current_user( self::$user_id ); 175 191 $this->wp_customize->add_setting( 'home' ); 176 192 $this->wp_customize->selective_refresh->add_partial( 'foo', array( 'settings' => array( 'home' ) ) ); … … 209 225 public function test_handle_rendering_disallowed_partial() { 210 226 $this->setup_valid_render_partials_request_environment(); 211 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));227 wp_set_current_user( self::$user_id ); 212 228 $this->wp_customize->add_setting( 213 229 'secret_message', … … 245 261 public function test_handle_rendering_partial_with_missing_settings() { 246 262 $this->setup_valid_render_partials_request_environment(); 247 wp_set_current_user( self:: factory()->user->create( array( 'role' => 'administrator' ) ));263 wp_set_current_user( self::$user_id ); 248 264 $this->wp_customize->selective_refresh->add_partial( 'bar', array( 'settings' => 'bar' ) ); 249 265
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)