Changeset 49112 for trunk/tests/phpunit/tests/admin/includesPlugin.php
- Timestamp:
- 10/09/2020 01:27:50 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPlugin.php
r48937 r49112 59 59 60 60 /** 61 * Tests the p riorityparameter.61 * Tests the position parameter. 62 62 * 63 63 * @ticket 39776 … … 65 65 * @covers ::add_submenu_page 66 66 * 67 * @param int $p riority The position ofthe new item.67 * @param int $position The position passed for the new item. 68 68 * @param int $expected_position Where the new item is expected to appear. 69 69 * 70 * @dataProvider data_submenu_p riority71 */ 72 function test_submenu_p riority( $priority, $expected_position ) {70 * @dataProvider data_submenu_position 71 */ 72 function test_submenu_position( $position, $expected_position ) { 73 73 global $submenu; 74 74 global $menu; … … 85 85 86 86 // Insert the new page. 87 add_submenu_page( $parent, 'New Page', 'New Page', 'manage_options', 'custom-position', 'custom_pos', $p riority);87 add_submenu_page( $parent, 'New Page', 'New Page', 'manage_options', 'custom-position', 'custom_pos', $position ); 88 88 wp_set_current_user( $current_user ); 89 89 … … 96 96 97 97 /** 98 * Tests the p riorityparameter for menu helper functions.98 * Tests the position parameter for menu helper functions. 99 99 * 100 100 * @ticket 39776 … … 113 113 * @covers ::add_comments_page 114 114 * 115 * @param int $p riority The position ofthe new item.115 * @param int $position The position passed for the new item. 116 116 * @param int $expected_position Where the new item is expected to appear. 117 117 * 118 * @dataProvider data_submenu_p riority119 */ 120 function test_submenu_helpers_p riority( $priority, $expected_position ) {118 * @dataProvider data_submenu_position 119 */ 120 function test_submenu_helpers_position( $position, $expected_position ) { 121 121 global $submenu; 122 122 global $menu; … … 190 190 $test = 'test_' . $helper_function['callback']; 191 191 192 // Call the helper function, passing the desired p riority.193 call_user_func_array( $helper_function['callback'], array( $test, $test, 'manage_options', 'custom-position', '', $p riority) );192 // Call the helper function, passing the desired position. 193 call_user_func_array( $helper_function['callback'], array( $test, $test, 'manage_options', 'custom-position', '', $position ) ); 194 194 195 195 $actual_positions[ $test ] = $submenu[ $helper_function['menu_root'] ][ $expected_position ][2]; … … 222 222 function submenus_to_add() { 223 223 return array( 224 array( 'Submenu P riority', 'Submenu Priority', 'manage_options', 'sub-page', '' ),225 array( 'Submenu P riority 2', 'Submenu Priority2', 'manage_options', 'sub-page2', '' ),226 array( 'Submenu P riority 3', 'Submenu Priority3', 'manage_options', 'sub-page3', '' ),227 array( 'Submenu P riority 4', 'Submenu Priority4', 'manage_options', 'sub-page4', '' ),228 array( 'Submenu P riority 5', 'Submenu Priority5', 'manage_options', 'sub-page5', '' ),224 array( 'Submenu Position', 'Submenu Position', 'manage_options', 'sub-page', '' ), 225 array( 'Submenu Position 2', 'Submenu Position 2', 'manage_options', 'sub-page2', '' ), 226 array( 'Submenu Position 3', 'Submenu Position 3', 'manage_options', 'sub-page3', '' ), 227 array( 'Submenu Position 4', 'Submenu Position 4', 'manage_options', 'sub-page4', '' ), 228 array( 'Submenu Position 5', 'Submenu Position 5', 'manage_options', 'sub-page5', '' ), 229 229 ); 230 230 } 231 231 232 232 /** 233 * Data provider for test_submenu_helpers_p riority().233 * Data provider for test_submenu_helpers_position(). 234 234 * 235 235 * @since 5.3.0 … … 237 237 * @return array { 238 238 * @type array { 239 * @type int|null P riority.239 * @type int|null Passed position. 240 240 * @type int Expected position. 241 241 * } 242 242 * } 243 243 */ 244 function data_submenu_p riority() {244 function data_submenu_position() { 245 245 $menu_count = count( $this->submenus_to_add() ); 246 246 return array( … … 257 257 258 258 /** 259 * Test that when a submenu has the same slug as a parent item, that it's just appended and ignores the p riority.259 * Test that when a submenu has the same slug as a parent item, that it's just appended and ignores the position. 260 260 * 261 261 * @ticket 48599 262 262 */ 263 function test_p riority_when_parent_slug_child_slug_are_the_same() {263 function test_position_when_parent_slug_child_slug_are_the_same() { 264 264 global $submenu, $menu; 265 265 … … 289 289 290 290 /** 291 * Passing a string as p rioritywill fail.291 * Passing a string as position will fail. 292 292 * 293 293 * @ticket 48599 294 294 */ 295 function test_passing_string_as_p riority_fires_doing_it_wrong() {295 function test_passing_string_as_position_fires_doing_it_wrong() { 296 296 $this->setExpectedIncorrectUsage( 'add_submenu_page' ); 297 297 global $submenu, $menu;
Note: See TracChangeset
for help on using the changeset viewer.