Skip to content

Commit

Permalink
Tests: Add previously deleted test back in
Browse files Browse the repository at this point in the history
This test was previously failing, but now seems to be working correctly.
  • Loading branch information
GaryJones committed Jul 30, 2023
1 parent 233eb09 commit e6fff38
Showing 1 changed file with 32 additions and 0 deletions.
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' );
}
}

0 comments on commit e6fff38

Please sign in to comment.