Skip to content

Commit

Permalink
add better messaging for failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed May 15, 2024
1 parent 79b16ef commit 6a15283
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/phpunit/test-page-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ public function test_cache_control_headers() {
$max_age = $this->get_max_age_from_rest_dispatch();

// Assert the default max-age.
$this->assertEquals( WEEK_IN_SECONDS, $max_age );
$this->assertEquals(
WEEK_IN_SECONDS,
$max_age,
sprintf( 'Expected max-age to be the default value (%1$d) but got %2$d', WEEK_IN_SECONDS, $max_age )
);

// Filter the default max-age to 120 seconds.
add_filter( 'pantheon_cache_default_max_age', function () {
Expand All @@ -250,7 +254,10 @@ public function test_cache_control_headers() {
$max_age = $this->get_max_age_from_rest_dispatch();

// Assert the filtered max-age.
$this->assertNotEquals( WEEK_IN_SECONDS, $max_age );
$this->assertEquals( 120, $max_age );
$this->assertEquals(
120,
$max_age,
sprintf( 'Expected max-age to be the filtered value (%1$d) but got %2$d', 120, $max_age )
);
}
}

0 comments on commit 6a15283

Please sign in to comment.