Skip to content

Commit

Permalink
Improve old comments tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 20, 2024
1 parent 57bc368 commit b63b09f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions tests/phpunit/tests/link/getNextCommentsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public function test_page_should_respect_value_of_cpage_query_var() {
$p = self::factory()->post->create();
$this->go_to( get_permalink( $p ) );

$cpage = get_query_var( 'cpage' );
$old_cpage = get_query_var( 'cpage' );
set_query_var( 'cpage', 3 );

$link = get_next_comments_link( 'Next', 5 );

$this->assertStringContainsString( 'cpage=4', $link );
set_query_var( 'cpage', $old_cpage );

set_query_var( 'cpage', $cpage );
$this->assertStringContainsString( 'cpage=4', $link );
}

/**
Expand All @@ -28,14 +28,14 @@ public function test_page_should_default_to_1_when_no_cpage_query_var_is_found()
$p = self::factory()->post->create();
$this->go_to( get_permalink( $p ) );

$cpage = get_query_var( 'cpage' );
$old_cpage = get_query_var( 'cpage' );
set_query_var( 'cpage', '' );

$link = get_next_comments_link( 'Next', 5 );

$this->assertStringContainsString( 'cpage=2', $link );
set_query_var( 'cpage', $old_cpage );

set_query_var( 'cpage', $cpage );
$this->assertStringContainsString( 'cpage=2', $link );
}

/**
Expand Down
12 changes: 6 additions & 6 deletions tests/phpunit/tests/link/getPreviousCommentsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ public function test_page_should_respect_value_of_cpage_query_var() {
$p = self::factory()->post->create();
$this->go_to( get_permalink( $p ) );

$cpage = get_query_var( 'cpage' );
$old_cpage = get_query_var( 'cpage' );
set_query_var( 'cpage', 3 );

$link = get_previous_comments_link( 'Previous' );

$this->assertStringContainsString( 'cpage=2', $link );
set_query_var( 'cpage', $old_cpage );

set_query_var( 'cpage', $cpage );
$this->assertStringContainsString( 'cpage=2', $link );
}

public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() {
$p = self::factory()->post->create();
$this->go_to( get_permalink( $p ) );

$cpage = get_query_var( 'cpage' );
$old_cpage = get_query_var( 'cpage' );
set_query_var( 'cpage', '' );

$link = get_previous_comments_link( 'Previous' );

set_query_var( 'cpage', $old_cpage );

// Technically, it returns null here.
$this->assertNull( $link );

set_query_var( 'cpage', $cpage );
}

/**
Expand Down

0 comments on commit b63b09f

Please sign in to comment.