WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#38761 closed defect (bug) (fixed)

Tests_WP_MS_Sites_List_Table test fails when run on their own

Reported by: xrmx Owned by: johnbillion
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch needs-testing has-unit-tests
Focuses: Cc:

Description

If i run the following command:

phpunit --filter Tests_WP_MS_Sites_List_Table -c tests/phpunit/multisite.xml

tests will fail with this message

Undefined index: hook_suffix

/srv/www/wordpress-develop/src/wp-admin/includes/class-wp-screen.php:229
/srv/www/wordpress-develop/src/wp-admin/includes/template.php:2029
/srv/www/wordpress-develop/src/wp-admin/includes/class-wp-list-table.php:143
/srv/www/wordpress-develop/src/wp-admin/includes/class-wp-ms-sites-list-table.php:48
/srv/www/wordpress-develop/src/wp-admin/includes/list-table.php:53
/srv/www/wordpress-develop/tests/phpunit/tests/multisite/wpMSSitesListTable.php:19

Attachments (1)

38761.diff (1.1 KB) - added by desrosj 4 months ago.
Fixes issue with test failing when called directly.

Download all attachments as: .zip

Change History (6)

#1 @johnbillion
4 months ago

  • Keywords needs-unit-tests added
  • Version trunk deleted

@desrosj
4 months ago

Fixes issue with test failing when called directly.

#2 @desrosj
4 months ago

  • Keywords has-patch needs-testing has-unit-tests added; needs-unit-tests removed

Patch fixes the issue by including the second parameter for _get_list_table(). There was one other test class where _get_list_table() was being called. I modified that test to use the second parameter instead of setting the global for consistency.

#3 @johnbillion
4 months ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 39481:

Build/Test Tools: Correctly set up the current screen during list table tests so that they don't fail when run individually.

Props desrosj
Fixes #38761

#4 @johnbillion
4 months ago

  • Milestone changed from Awaiting Review to 4.8

#5 @johnbillion
4 months ago

  • Milestone changed from 4.8 to 4.7
Note: See TracTickets for help on using tickets.