Changeset 35724 for trunk/tests/phpunit/tests/customize/widgets.php
- Timestamp:
- 11/21/2015 02:51:57 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/widgets.php
r35242 r35724 292 292 $this->assertFalse( $this->manager->get_panel( 'widgets' )->active() ); 293 293 } 294 295 /** 296 * @ticket 34738 297 * @see WP_Customize_Widgets::call_widget_update() 298 */ 299 function test_call_widget_update() { 300 301 $widget_number = 2; 302 $widget_id = "search-{$widget_number}"; 303 $setting_id = "widget_search[{$widget_number}]"; 304 $instance = array( 305 'title' => 'Buscar', 306 ); 307 308 $_POST = wp_slash( array( 309 'action' => 'update-widget', 310 'wp_customize' => 'on', 311 'nonce' => wp_create_nonce( 'update-widget' ), 312 'theme' => $this->manager->get_stylesheet(), 313 'customized' => '{}', 314 'widget-search' => array( 315 2 => $instance, 316 ), 317 'widget-id' => $widget_id, 318 'id_base' => 'search', 319 'widget-width' => '250', 320 'widget-height' => '200', 321 'widget_number' => strval( $widget_number ), 322 'multi_number' => '', 323 'add_new' => '', 324 ) ); 325 326 $this->do_customize_boot_actions(); 327 328 $this->assertArrayNotHasKey( $setting_id, $this->manager->unsanitized_post_values() ); 329 $result = $this->manager->widgets->call_widget_update( $widget_id ); 330 331 $this->assertInternalType( 'array', $result ); 332 $this->assertArrayHasKey( 'instance', $result ); 333 $this->assertArrayHasKey( 'form', $result ); 334 $this->assertEquals( $instance, $result['instance'] ); 335 $this->assertContains( sprintf( 'value="%s"', esc_attr( $instance['title'] ) ), $result['form'] ); 336 337 $post_values = $this->manager->unsanitized_post_values(); 338 $this->assertArrayHasKey( $setting_id, $post_values ); 339 $post_value = $post_values[ $setting_id ]; 340 $this->assertInternalType( 'array', $post_value ); 341 $this->assertArrayHasKey( 'title', $post_value ); 342 $this->assertArrayHasKey( 'encoded_serialized_instance', $post_value ); 343 $this->assertArrayHasKey( 'instance_hash_key', $post_value ); 344 $this->assertArrayHasKey( 'is_widget_customizer_js_value', $post_value ); 345 $this->assertEquals( $post_value, $this->manager->widgets->sanitize_widget_js_instance( $instance ) ); 346 } 294 347 }
Note: See TracChangeset
for help on using the changeset viewer.