Changeset 63434
- Timestamp:
- 09/02/2026 02:32:15 PM (less than one hour ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/view-config.php (modified) (2 diffs)
-
tests/phpunit/tests/view-config.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/view-config.php
r63355 r63434 77 77 'id' => 'status', 78 78 'label' => __( 'Status' ), 79 'layout' => array( 80 'type' => 'panel', 81 'summary' => 'status', 82 ), 79 83 'children' => array( 80 84 array( … … 97 101 'id' => 'discussion', 98 102 'label' => __( 'Discussion' ), 103 'layout' => array( 104 'type' => 'panel', 105 'summary' => 'discussion', 106 ), 99 107 'children' => array( 100 108 array( -
trunk/tests/phpunit/tests/view-config.php
r62970 r63434 76 76 77 77 /** 78 * Returns the form field with the given id from a view configuration. 79 * 80 * @param array $config The view configuration. 81 * @param string $id The form field id. 82 * @return array|null The form field, or null when absent. 83 */ 84 private function get_form_field( $config, $id ) { 85 foreach ( $config['form']['fields'] as $field ) { 86 if ( is_array( $field ) && isset( $field['id'] ) && $id === $field['id'] ) { 87 return $field; 88 } 89 } 90 return null; 91 } 92 93 /** 94 * The `status` and `discussion` groups of the default post type form declare 95 * their panel summary explicitly, for built-in and custom post types alike. 96 * 97 * @ticket 65981 98 * 99 * @dataProvider data_default_form_post_types 100 * 101 * @param string $post_type The post type. 102 */ 103 public function test_default_form_groups_declare_summary( $post_type ) { 104 if ( ! post_type_exists( $post_type ) ) { 105 register_post_type( $post_type ); 106 } 107 108 $config = wp_get_entity_view_config( 'postType', $post_type ); 109 110 foreach ( array( 'status', 'discussion' ) as $group ) { 111 $field = $this->get_form_field( $config, $group ); 112 $this->assertNotNull( $field, "The `{$group}` group is present." ); 113 $this->assertNotEmpty( $field['children'], "The `{$group}` group keeps its children." ); 114 $this->assertSame( 115 array( 116 'type' => 'panel', 117 'summary' => $group, 118 ), 119 $field['layout'], 120 "The `{$group}` group summary is explicit." 121 ); 122 } 123 124 if ( 'page' !== $post_type && 'post' !== $post_type ) { 125 unregister_post_type( $post_type ); 126 } 127 } 128 129 /** 130 * Data provider. 131 * 132 * @return array[] 133 */ 134 public function data_default_form_post_types() { 135 return array( 136 'page' => array( 'page' ), 137 'post' => array( 'post' ), 138 'custom post type' => array( 'summaries_cpt' ), 139 ); 140 } 141 142 /** 78 143 * The default configuration exposes the documented shape for an unknown entity. 79 144 */
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)