Changeset 52569 for trunk/tests/phpunit/tests/admin/includesPlugin.php
- Timestamp:
- 01/12/2022 11:23:41 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPlugin.php
r52389 r52569 297 297 298 298 /** 299 * Passing a string as position will fail .299 * Passing a string as position will fail in submenu. 300 300 * 301 301 * @ticket 48599 302 302 */ 303 public function test_passing_string_as_position_fires_doing_it_wrong () {303 public function test_passing_string_as_position_fires_doing_it_wrong_submenu() { 304 304 $this->setExpectedIncorrectUsage( 'add_submenu_page' ); 305 305 global $submenu, $menu; … … 325 325 } 326 326 327 /** 328 * Passing a string as position will fail in menu. 329 * 330 * @ticket 48599 331 */ 332 public function test_passing_string_as_position_fires_doing_it_wrong_menu() { 333 $this->setExpectedIncorrectUsage( 'add_menu_page' ); 334 global $submenu, $menu; 335 336 // Reset menus. 337 $submenu = array(); 338 $menu = array(); 339 $current_user = get_current_user_id(); 340 $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) ); 341 wp_set_current_user( $admin_user ); 342 set_current_screen( 'dashboard' ); 343 344 // 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 ); 347 348 // Clean up the temporary user. 349 wp_set_current_user( $current_user ); 350 wp_delete_user( $admin_user ); 351 352 // Verify the menu was inserted. 353 $this->assertSame( 'main_slug', $menu[1][2] ); 354 // Verify the menu was inserted correctly on passing float as position. 355 $this->assertSame( 'main1_slug', $menu['1.5'][2] ); 356 } 357 327 358 public function test_is_plugin_active_true() { 328 359 activate_plugin( 'hello.php' );
Note: See TracChangeset
for help on using the changeset viewer.