Changeset 59564
- Timestamp:
- 12/28/2024 10:08:19 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-admin/includes/template.php (modified) (1 diff)
-
tests/phpunit/tests/admin/includesTemplate.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r59224 r59564 1785 1785 } 1786 1786 1787 if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { 1788 continue; 1789 } 1790 echo '<table class="form-table" role="presentation">'; 1791 do_settings_fields( $page, $section['id'] ); 1792 echo '</table>'; 1787 if ( isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { 1788 echo '<table class="form-table" role="presentation">'; 1789 do_settings_fields( $page, $section['id'] ); 1790 echo '</table>'; 1791 } 1793 1792 1794 1793 if ( '' !== $section['after_section'] ) { -
trunk/tests/phpunit/tests/admin/includesTemplate.php
r58136 r59564 242 242 243 243 /** 244 * @ticket 62746 245 * 246 * @param array $extra_args Extra arguments to pass to function `add_settings_section()`. 247 * @param array $expected_section_data Expected set of section data. 248 * @param string $expected_before_section_html Expected HTML markup to be rendered before the settings section. 249 * @param string $expected_after_section_html Expected HTML markup to be rendered after the settings section. 250 * 251 * @covers ::add_settings_section 252 * @covers ::do_settings_sections 253 * 254 * @dataProvider data_extra_args_for_add_settings_section 255 */ 256 public function test_add_settings_section_without_any_fields( $extra_args, $expected_section_data, $expected_before_section_html, $expected_after_section_html ) { 257 add_settings_section( 'test-section', 'Section title', '__return_false', 'test-page', $extra_args ); 258 259 ob_start(); 260 do_settings_sections( 'test-page' ); 261 $output = ob_get_clean(); 262 263 $this->assertStringContainsString( $expected_before_section_html, $output, 'Test page output does not contain the custom markup to be placed before the section.' ); 264 $this->assertStringContainsString( $expected_after_section_html, $output, 'Test page output does not contain the custom markup to be placed after the section.' ); 265 } 266 267 /** 244 268 * Data provider for `test_add_settings_section_with_extra_args()`. 245 269 *
Note: See TracChangeset
for help on using the changeset viewer.