|
@@ 2338-2360 (lines=23) @@
|
| 2335 |
|
/** |
| 2336 |
|
* @ticket 34596 |
| 2337 |
|
*/ |
| 2338 |
|
function test_add_section_return_instance() { |
| 2339 |
|
$manager = new WP_Customize_Manager(); |
| 2340 |
|
wp_set_current_user( self::$admin_user_id ); |
| 2341 |
|
|
| 2342 |
|
$section_id = 'foo-section'; |
| 2343 |
|
$result_section = $manager->add_section( $section_id, array( |
| 2344 |
|
'title' => 'Section', |
| 2345 |
|
'priority' => 1, |
| 2346 |
|
) ); |
| 2347 |
|
|
| 2348 |
|
$this->assertInstanceOf( 'WP_Customize_Section', $result_section ); |
| 2349 |
|
$this->assertEquals( $section_id, $result_section->id ); |
| 2350 |
|
|
| 2351 |
|
$section = new WP_Customize_Section( $manager, $section_id, array( |
| 2352 |
|
'title' => 'Section 2', |
| 2353 |
|
'priority' => 2, |
| 2354 |
|
) ); |
| 2355 |
|
$result_section = $manager->add_section( $section ); |
| 2356 |
|
|
| 2357 |
|
$this->assertInstanceOf( 'WP_Customize_Section', $result_section ); |
| 2358 |
|
$this->assertEquals( $section_id, $result_section->id ); |
| 2359 |
|
$this->assertEquals( $section, $result_section ); |
| 2360 |
|
} |
| 2361 |
|
|
| 2362 |
|
/** |
| 2363 |
|
* @ticket 34596 |
|
@@ 2436-2457 (lines=22) @@
|
| 2433 |
|
/** |
| 2434 |
|
* @ticket 34596 |
| 2435 |
|
*/ |
| 2436 |
|
function test_add_panel_return_instance() { |
| 2437 |
|
$manager = new WP_Customize_Manager(); |
| 2438 |
|
wp_set_current_user( self::$admin_user_id ); |
| 2439 |
|
|
| 2440 |
|
$panel_id = 'foo-panel'; |
| 2441 |
|
$result_panel = $manager->add_panel( $panel_id, array( |
| 2442 |
|
'title' => 'Test Panel', |
| 2443 |
|
'priority' => 2, |
| 2444 |
|
) ); |
| 2445 |
|
|
| 2446 |
|
$this->assertInstanceOf( 'WP_Customize_Panel', $result_panel ); |
| 2447 |
|
$this->assertEquals( $panel_id, $result_panel->id ); |
| 2448 |
|
|
| 2449 |
|
$panel = new WP_Customize_Panel( $manager, $panel_id, array( |
| 2450 |
|
'title' => 'Test Panel 2', |
| 2451 |
|
) ); |
| 2452 |
|
$result_panel = $manager->add_panel( $panel ); |
| 2453 |
|
|
| 2454 |
|
$this->assertInstanceOf( 'WP_Customize_Panel', $result_panel ); |
| 2455 |
|
$this->assertEquals( $panel, $result_panel ); |
| 2456 |
|
$this->assertEquals( $panel_id, $result_panel->id ); |
| 2457 |
|
} |
| 2458 |
|
|
| 2459 |
|
/** |
| 2460 |
|
* @ticket 34596 |