Changeset 53104 for trunk/tests/phpunit/tests/admin/includesPlugin.php
- Timestamp:
- 04/08/2022 06:15:02 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPlugin.php
r52570 r53104 257 257 array( -1, 0 ), // Negative numbers are treated the same as passing 0. 258 258 array( -7, 0 ), // Negative numbers are treated the same as passing 0. 259 array( '-7', 0 ), // Negative numbers are treated the same as passing 0. 259 260 array( 1, 1 ), // Insert as the second item. 261 array( '1', 1 ), // Insert as the second item. 262 array( 1.5, 1 ), // Insert as the second item. 263 array( '1.5', 1 ), // Insert as the second item. 260 264 array( 3, 3 ), // Insert as the 4th item. 265 array( '3', 3 ), // Insert as the 4th item. 266 array( '3e0', 3 ), // Insert as the 4th item. 267 array( 3.5, 3 ), // Insert as the 4th item. 268 array( '3.5', 3 ), // Insert as the 4th item. 261 269 array( $menu_count, $menu_count ), // Numbers equal to the number of items are added at the end. 262 270 array( 123456, $menu_count ), // Numbers higher than the number of items are added at the end. … … 315 323 // Setup a menu with some items. 316 324 add_menu_page( 'Main Menu', 'Main Menu', 'manage_options', 'main_slug', 'main_page_callback' ); 317 add_submenu_page( 'main_slug', 'SubMenu 1', 'SubMenu 1', 'manage_options', 'submenu_page_1', 'submenu_callback_1', ' 2' );325 add_submenu_page( 'main_slug', 'SubMenu 1', 'SubMenu 1', 'manage_options', 'submenu_page_1', 'submenu_callback_1', 'First' ); 318 326 319 327 // Clean up the temporary user. … … 330 338 * @ticket 54798 331 339 */ 332 public function test_passing_string_as_position_fires_doing_it_wrong_menu() { 333 $this->setExpectedIncorrectUsage( 'add_menu_page' ); 340 public function test_passing_float_as_position_does_not_override_int() { 334 341 global $submenu, $menu; 335 342 … … 343 350 344 351 // Setup a menu with some items. 345 add_menu_page( 'Main Menu', 'Main Menu', 'manage_options', 'main_slug', 'main_page_callback', 'icon_url', '1' ); 346 add_menu_page( 'Main Menu 1', 'Main Menu 1', 'manage_options', 'main1_slug', 'main1_page_callback', 'icon_url1', 1.5 ); 352 add_menu_page( 'Main Menu 1', 'Main Menu 1', 'manage_options', 'main_slug_1', 'main_page_callback_1', 'icon_url_1', 1 ); 353 add_menu_page( 'Main Menu 2', 'Main Menu 2', 'manage_options', 'main_slug_2', 'main_page_callback_2', 'icon_url_2', 2 ); 354 add_menu_page( 'Main Menu 1.5', 'Main Menu 1.5', 'manage_options', 'main_slug_15', 'main_page_callback_15', 'icon_url_15', 1.5 ); 347 355 348 356 // Clean up the temporary user. … … 350 358 wp_delete_user( $admin_user ); 351 359 352 // Verify the menu was inserted. 353 $this->assertSame( 'main_slug', $menu[1][2] ); 360 // Verify the menus were inserted. 361 $this->assertSame( 'main_slug_1', $menu[1][2] ); 362 $this->assertSame( 'main_slug_2', $menu[2][2] ); 354 363 // Verify the menu was inserted correctly on passing float as position. 355 $this->assertSame( 'main 1_slug', $menu['1.5'][2] );364 $this->assertSame( 'main_slug_15', $menu['1.5'][2] ); 356 365 } 357 366
Note: See TracChangeset
for help on using the changeset viewer.