Skip to content

Commit 737d1da

Browse files
committed
Update test cases for SiteHealth service
1 parent cc51000 commit 737d1da

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/php/src/Admin/SiteHealthTest.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,17 @@ public function test_register_async_test_endpoints() {
153153
*/
154154
public function test_add_tests() {
155155
$tests = $this->instance->add_tests( [] );
156+
156157
$this->assertArrayHasKey( 'direct', $tests );
157-
$this->assertArrayHasKey( 'amp_persistent_object_cache', $tests['direct'] );
158158

159-
if ( version_compare( get_bloginfo( 'version' ), '5.6', '>=' ) ) {
160-
$this->assertArrayHasKey( 'amp_page_cache', $tests['async'] );
161-
} elseif ( array_key_exists( 'async', $tests ) ) {
162-
$this->assertArrayNotHasKey( 'amp_page_cache', $tests['async'] );
159+
if ( ! version_compare( get_bloginfo( 'version' ), '6.1', '>=' ) ) {
160+
$this->assertArrayHasKey( 'amp_persistent_object_cache', $tests['direct'] );
161+
162+
if ( version_compare( get_bloginfo( 'version' ), '5.6', '>=' ) ) {
163+
$this->assertArrayHasKey( 'amp_page_cache', $tests['async'] );
164+
} elseif ( array_key_exists( 'async', $tests ) ) {
165+
$this->assertArrayNotHasKey( 'amp_page_cache', $tests['async'] );
166+
}
163167
}
164168

165169
$this->assertArrayHasKey( 'amp_curl_multi_functions', $tests['direct'] );
@@ -698,6 +702,10 @@ public function test_add_extensions() {
698702
* @covers ::get_good_response_time_threshold()
699703
*/
700704
public function test_get_good_response_time_threshold() {
705+
if ( version_compare( get_bloginfo( 'version' ), '6.1', '>=' ) ) {
706+
$this->markTestSkipped( '`amp_page_cache_good_response_time_threshold` is deprecated in WordPress 6.1 and above.' );
707+
}
708+
701709
$this->assertSame( 600, $this->instance->get_good_response_time_threshold() );
702710

703711
add_filter(
@@ -918,6 +926,9 @@ public function get_page_cache_data() {
918926
* @covers ::check_for_page_caching()
919927
*/
920928
public function test_page_cache( $responses, $expected_status, $expected_label, $good_basic_auth = null, $delay_the_response = false ) {
929+
if ( version_compare( get_bloginfo( 'version' ), '6.1', '>=' ) ) {
930+
$this->markTestSkipped( 'AMP plugin omits page and object caching tests for Site Health if on WP>=6.1 ' );
931+
}
921932

922933
$badge_color = [
923934
'critical' => 'red',

0 commit comments

Comments
 (0)