- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/selective-refresh-ajax.php
r41293 r42343 141 141 $this->setup_valid_render_partials_request_environment(); 142 142 $context_data = array(); 143 $placements = array( $context_data ); 144 145 $_POST['partials'] = wp_slash( wp_json_encode( array( 146 'foo' => $placements, 147 ) ) ); 143 $placements = array( $context_data ); 144 145 $_POST['partials'] = wp_slash( 146 wp_json_encode( 147 array( 148 'foo' => $placements, 149 ) 150 ) 151 ); 148 152 149 153 ob_start(); … … 177 181 $this->wp_customize->selective_refresh->add_partial( 'foo', array( 'settings' => array( 'home' ) ) ); 178 182 $context_data = array(); 179 $placements = array( $context_data ); 180 181 $_POST['partials'] = wp_slash( wp_json_encode( array( 182 'foo' => $placements, 183 ) ) ); 183 $placements = array( $context_data ); 184 185 $_POST['partials'] = wp_slash( 186 wp_json_encode( 187 array( 188 'foo' => $placements, 189 ) 190 ) 191 ); 184 192 185 193 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); 186 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' );194 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); 187 195 ob_start(); 188 196 try { … … 209 217 $this->setup_valid_render_partials_request_environment(); 210 218 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 211 $this->wp_customize->add_setting( 'secret_message', array( 212 'capability' => 'top_secret_clearance', 213 ) ); 219 $this->wp_customize->add_setting( 220 'secret_message', array( 221 'capability' => 'top_secret_clearance', 222 ) 223 ); 214 224 $this->wp_customize->selective_refresh->add_partial( 'secret_message', array( 'settings' => 'secret_message' ) ); 215 225 216 $context_data = array(); 217 $placements = array( $context_data ); 218 $_POST['partials'] = wp_slash( wp_json_encode( array( 219 'secret_message' => $placements, 220 ) ) ); 226 $context_data = array(); 227 $placements = array( $context_data ); 228 $_POST['partials'] = wp_slash( 229 wp_json_encode( 230 array( 231 'secret_message' => $placements, 232 ) 233 ) 234 ); 221 235 222 236 ob_start(); … … 240 254 $this->wp_customize->selective_refresh->add_partial( 'bar', array( 'settings' => 'bar' ) ); 241 255 242 $context_data = array(); 243 $placements = array( $context_data ); 244 $_POST['partials'] = wp_slash( wp_json_encode( array( 245 'bar' => $placements, 246 ) ) ); 256 $context_data = array(); 257 $placements = array( $context_data ); 258 $_POST['partials'] = wp_slash( 259 wp_json_encode( 260 array( 261 'bar' => $placements, 262 ) 263 ) 264 ); 247 265 248 266 ob_start(); … … 291 309 $this->setup_valid_render_partials_request_environment(); 292 310 293 $this->wp_customize->selective_refresh->add_partial( 'test_blogname', array( 294 'settings' => array( 'blogname' ), 295 'render_callback' => array( $this, 'render_callback_blogname' ), 296 ) ); 311 $this->wp_customize->selective_refresh->add_partial( 312 'test_blogname', array( 313 'settings' => array( 'blogname' ), 314 'render_callback' => array( $this, 'render_callback_blogname' ), 315 ) 316 ); 297 317 298 318 $context_data = array(); 299 $placements = array( $context_data ); 300 301 $_POST['partials'] = wp_slash( wp_json_encode( array( 302 'test_blogname' => $placements, 303 ) ) ); 319 $placements = array( $context_data ); 320 321 $_POST['partials'] = wp_slash( 322 wp_json_encode( 323 array( 324 'test_blogname' => $placements, 325 ) 326 ) 327 ); 304 328 305 329 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); 306 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' );330 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); 307 331 ob_start(); 308 332 try { … … 333 357 if ( 'test_dynamic_blogname' === $partial_id ) { 334 358 $partial_args = array( 335 'settings' => array( 'blogname' ),359 'settings' => array( 'blogname' ), 336 360 'render_callback' => array( $this, 'render_callback_blogname' ), 337 361 ); … … 402 426 403 427 $context_data = array(); 404 $placements = array( $context_data ); 405 406 $_POST['partials'] = wp_slash( wp_json_encode( array( 407 'test_dynamic_blogname' => $placements, 408 ) ) ); 428 $placements = array( $context_data ); 429 430 $_POST['partials'] = wp_slash( 431 wp_json_encode( 432 array( 433 'test_dynamic_blogname' => $placements, 434 ) 435 ) 436 ); 409 437 410 438 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); 411 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' );439 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); 412 440 ob_start(); 413 441 try { … … 434 462 $this->setup_valid_render_partials_request_environment(); 435 463 436 $this->wp_customize->selective_refresh->add_partial( 'test_blogname', array( 437 'settings' => array( 'blogname' ), 438 'render_callback' => array( $this, 'render_callback_blogname' ), 439 ) ); 440 $this->wp_customize->selective_refresh->add_partial( 'test_blogdescription', array( 441 'settings' => array( 'blogdescription' ), 442 'render_callback' => array( $this, 'render_callback_blogdescription' ), 443 ) ); 464 $this->wp_customize->selective_refresh->add_partial( 465 'test_blogname', array( 466 'settings' => array( 'blogname' ), 467 'render_callback' => array( $this, 'render_callback_blogname' ), 468 ) 469 ); 470 $this->wp_customize->selective_refresh->add_partial( 471 'test_blogdescription', array( 472 'settings' => array( 'blogdescription' ), 473 'render_callback' => array( $this, 'render_callback_blogdescription' ), 474 ) 475 ); 444 476 445 477 $placement_context_data = array(); 446 478 447 $_POST['partials'] = wp_slash( wp_json_encode( array( 448 'test_blogname' => array( $placement_context_data ), 449 'test_blogdescription' => array( $placement_context_data, $placement_context_data ), 450 ) ) ); 479 $_POST['partials'] = wp_slash( 480 wp_json_encode( 481 array( 482 'test_blogname' => array( $placement_context_data ), 483 'test_blogdescription' => array( $placement_context_data, $placement_context_data ), 484 ) 485 ) 486 ); 451 487 452 488 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); 453 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' );489 $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); 454 490 ob_start(); 455 491 try { … … 474 510 function tearDown() { 475 511 $this->expected_partial_ids = null; 476 $this->wp_customize = null;512 $this->wp_customize = null; 477 513 unset( $GLOBALS['wp_customize'] ); 478 514 unset( $GLOBALS['wp_scripts'] );
Note: See TracChangeset
for help on using the changeset viewer.