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

Tests: Add previously deleted test back in #967

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/test-author-queried-object.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,36 @@ function test__author_queried_object_fix() {

restore_current_blog();
}

/**
* On author pages, when paginated,
* if page number is outside the range, throws 404.
*
* @group ms-required
*/
function test__author_non_existent_page_throws_404() {
global $wp_rewrite;

/**
* Set up
*/
$author = $this->factory()->user->create( array( 'user_login' => 'author' ) );
$blog = $this->factory()->blog->create( array( 'user_id' => $author ) );

switch_to_blog( $blog );
$wp_rewrite->init();

/**
* Author non-existent page throws 404
*/
$non_existent_page = 1000;
$this->go_to( get_author_posts_url( $author ) . 'page/' . $non_existent_page );
$this->assertQueryTrue( 'is_404' );

/**
* Author existent page loads
*/
$this->go_to( get_author_posts_url( $author ) );
$this->assertQueryTrue( 'is_archive', 'is_author' );
}
}