Removed Test_Author_Queried_Object setUp function #540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #526 -
test__author_queried_object_fix()
fails when run twice.After tests are run, the database should be properly cleaned by the WP testcase itself, so I dug into the core tests handling to see why that was not happening. Apparently, all queries were being run as
TEMPORARY
, except the ones from this test. Thus, this statement (which is where the test hanged for me):failed, because the blog (and related db tables) were already present.
And indeed, it failed because of the filters in
test-author-queried-object.php
setUp()
function, which prevented the default behavior of declaring the new site tables asTEMPORARY
. Commenting those two filters out, tests succeed AND can be run an arbitrary number of times (without throwing any errors).As a side note,
WP_UnitTestCase->tearDown()
, which executes$wpdb->query( 'ROLLBACK' );
and thus deletes all temporary tables, is called at the end of each plugin test, so it shouldn't create any issues, and those filters are not needed.I have thus deleted the whole function, since it was not doing anything besides setting up the filters. All tests still pass okay!