Tests/admin/wpListTable: split the test class (Trac 53010)#6235
Tests/admin/wpListTable: split the test class (Trac 53010)#6235jrfnl wants to merge 4 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Most tests test testing the `WP_List_Table` class will need the same set up/tear down fixtures, so moving those fixtures from the actual test class to a separate abstract `TestCase` class will allow for expanding the tests more easily. While doing this, we ran the tests in isolation using the `--filter` CLI argument and discovered that there was a previously unrecognized presumption in the fixtures that the `$hook_suffix` global would always be set. This presumption proved incorrect as was demonstrated by the `Undefined global variable $hook_suffix` warning being thrown when running the tests. This warning has been fixed now in the new `Admin_WpListTable_TestCase` by adding some additional defensive coding and making sure that the global state is always brought back to its original state, including if that original state means that the `$hook_suffix` global variable was not set. Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
…thod to separate test class This will allow the test class to be compatible with PHPUnit 11 using the new `Admin_WpListTable_TestCase` class as introduced in the previous commit. Includes removing method level `@covers` tags in favour of class level `@covers` tags to allow for supporting PHPUnit 11 attributes instead of annotations. Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
…thod to separate test class This will allow the test class to be compatible with PHPUnit 11 using the new `Admin_WpListTable_TestCase` class as introduced in the previous commit. Includes removing method level `@covers` tags in favour of class level `@covers` tags to allow for supporting PHPUnit 11 attributes instead of annotations. Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
…scriptive for the remaining tests The remaining tests in the original test class all cover the magic methods and those are very closely related, so it is perfectly fine for those tests to be grouped together in one test class. This commit, however, does rename the test class to use the new naming conventions, both for the class name as well as the file name. It also includes removing method level `@covers` tags in favour of class level `@covers` tags to allow for supporting PHPUnit 11 attributes instead of annotations. This will allow the test class to be compatible with PHPUnit 11. Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
251633d to
931ec26
Compare
Tests/admin/wpListTable: create a testcase for tests for WP_List_Table
Most tests testing the
WP_List_Tableclass will need the same set up/tear down fixtures, so moving those fixtures from the actual test class to a separate abstractTestCaseclass will allow for expanding the tests more easily.While doing this, we ran the tests in isolation using the
--filterCLI argument and discovered that there was a previously unrecognized presumption in the fixtures that the$hook_suffixglobal would always be set.This presumption proved incorrect as was demonstrated by the
Undefined global variable $hook_suffixwarning being thrown when running the tests.This warning has been fixed now in the new
Admin_WpListTable_TestCaseby adding some additional defensive coding and making sure that the global state is always brought back to its original state, including if that original state means that the$hook_suffixglobal variable was not set.Tests/admin/wpListTable: split off tests for the get_column_info() method to separate test class
This will allow the test class to be compatible with PHPUnit 11 using the new
Admin_WpListTable_TestCaseclass as introduced in the previous commit.Includes removing method level
@coverstags in favour of class level@coverstags to allow for supporting PHPUnit 11 attributes instead of annotations.Tests/admin/wpListTable: split off tests for the get_views_links() method to separate test class
This will allow the test class to be compatible with PHPUnit 11 using the new
Admin_WpListTable_TestCaseclass as introduced in the previous commit.Includes removing method level
@coverstags in favour of class level@coverstags to allow for supporting PHPUnit 11 attributes instead of annotations.Tests/admin/wpListTable: rename the original test class to be more descriptive for the remaining tests
The remaining tests in the original test class all cover the magic methods and those are very closely related, so it is perfectly fine for those tests to be grouped together in one test class.
This commit, however, does rename the test class to use the new naming conventions, both for the class name as well as the file name.
It also includes removing method level
@coverstags in favour of class level@coverstags to allow for supporting PHPUnit 11 attributes instead of annotations.This will allow the test class to be compatible with PHPUnit 11.
Trac ticket: https://core.trac.wordpress.org/ticket/53010
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.