Opened 7 years ago
Last modified 6 years ago
#41451 new enhancement
Use pretty permalinks by default in the test suite
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
There are 118 instances of $this->set_permalink_structure( ... )
in the test suite. The majority of these calls are present simply to enable pretty permalinks, regardless of the permastructure for posts.
Pretty permalinks should be enabled by default for the test suite. Let's try it and see if anything breaks.
Attachments (1)
Change History (7)
#2
@
7 years ago
Started working on this, and overall things don't look too bad.
#42452 is a blocker right now, because with pretty permalinks enabled, the majority of REST API tests fail.
#4
@
7 years ago
Work in progress: https://github.com/fklein-lu/wordpress-develop/pull/1/files
#5
@
7 years ago
The patch above contains the code that makes all the tests, except three multisite tests, pass with pretty permalinks enabled. I was unable to fix these, so I'd be happy if somebody else could look into this.
This Travis CI log contains the failing tests:
Tests_Query_VerbosePageRules
: This keeps failing no matter what I try. The wayWP_UnitTestCase::goto
behaves is not very transparent, and I can't figure it out.Tests_Rewrite_OldSlugRedirect
andTests_Feeds_RSS2
pass on local, but fail on Travis.
A few notes about the patch:
- I did not account for non-Core test runs at this point. We could add a bunch of
WP_RUN_CORE_TESTS
checks, but I feel like a more elegant solution would be welcome. - I introduced helper functions for permalink handling. I'm not a fan of stuffing everything into
WP_UnitTestCase
if it doesn't need to be part of the class. The helper functions are also more efficient, asUnitTestCase::set_permalink_structure
callsWP_Rewrite::init
twice. - I did only adapt the existing tests so that they pass. This might not always be the past way for the thing being tested.
Previously: [34802], [34803], [34807], and [34810]