Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix canonical tests and page for posts not redirected #634

Merged
merged 7 commits into from Nov 17, 2020

Conversation

Chouby
Copy link
Contributor

@Chouby Chouby commented Nov 9, 2020

This PR fixes the canonical tests:

  • Correctly applies the right option for each test with a page for posts.
  • Rename tests which wrongly refered to a static front page.

This revealed that test_page_for_post_option_should_be_translated_from_plain_permalink() was wrongly passing.
=> Fix the code accordingly.

This will avoid to duplicate filters from several instances of PLL_Frontend_Static_Pages (from the test and the  PLL_Frontend::init() call in the setup)
Data is only needed when WordPress sitemaps module will generate the actual sitemaps, rewrite rules are not modified.
Copy link
Contributor

@raaaahman raaaahman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we needed a first test to run in order to reset the $GLOBAL['wp_sitemaps'] variable: https://github.com/WordPress/wordpress-develop/blob/eb9fb00ee60ed392179f7f8148a2b4fcf6b05ff9/tests/phpunit/includes/abstract-testcase.php#L161

@Chouby Chouby merged commit 7297dc0 into master Nov 17, 2020
@Chouby Chouby deleted the canonical_test_alt branch November 17, 2020 14:05
@@ -387,20 +387,20 @@ public function check_canonical_url( $requested_url = '', $do_redirect = true )
if ( $this->model->is_translated_taxonomy( $this->get_queried_taxonomy( $wp_query->tax_query ) ) ) {
$term_id = $this->get_queried_term_id( $wp_query->tax_query );
$language = $this->model->term->get_language( $term_id );
$redirect_url = get_term_link( $term_id );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make an explanation in a new PR

Chouby added a commit that referenced this pull request Nov 23, 2020
Co-authored-by: Frédéric Demarle <frederic.demarle@yahoo.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants