Changeset 59213 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 10/10/2024 09:05:04 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r58936 r59213 2442 2442 2443 2443 $this->assertEqualSetsWithIndex( $expected, $actual ); 2444 } 2445 2446 /** 2447 * This test covers `get_block_nodes` with the `$include_node_paths_only` option. 2448 * When `true`, `$include_node_paths_only` should return only the paths of the block nodes. 2449 * 2450 * @ticket 61858 2451 */ 2452 public function test_return_block_node_paths() { 2453 $theme_json = new ReflectionClass( 'WP_Theme_JSON' ); 2454 2455 $func = $theme_json->getMethod( 'get_block_nodes' ); 2456 $func->setAccessible( true ); 2457 2458 $theme_json = array( 2459 'version' => WP_Theme_JSON::LATEST_SCHEMA, 2460 'styles' => array( 2461 'typography' => array( 2462 'fontSize' => '16px', 2463 ), 2464 'blocks' => array( 2465 'core/button' => array( 2466 'color' => array( 2467 'background' => 'red', 2468 ), 2469 ), 2470 'core/group' => array( 2471 'elements' => array( 2472 'link' => array( 2473 'color' => array( 2474 'background' => 'blue', 2475 ), 2476 ), 2477 ), 2478 ), 2479 ), 2480 ), 2481 ); 2482 2483 $block_nodes = $func->invoke( null, $theme_json, array(), array( 'include_node_paths_only' => true ) ); 2484 2485 $expected = array( 2486 array( 2487 'path' => array( 'styles', 'blocks', 'core/button' ), 2488 ), 2489 array( 2490 'path' => array( 'styles', 'blocks', 'core/group' ), 2491 ), 2492 array( 2493 'path' => array( 'styles', 'blocks', 'core/group', 'elements', 'link' ), 2494 ), 2495 ); 2496 2497 $this->assertEquals( $expected, $block_nodes ); 2444 2498 } 2445 2499
Note: See TracChangeset
for help on using the changeset viewer.