diff --git a/tests/phpunit/tests/admin/wpSiteHealthAutoUpdates.php b/tests/phpunit/tests/admin/wpSiteHealthAutoUpdates.php
index 4366a6ef1fc5e..6561b6a99e08d 100644
--- a/tests/phpunit/tests/admin/wpSiteHealthAutoUpdates.php
+++ b/tests/phpunit/tests/admin/wpSiteHealthAutoUpdates.php
@@ -52,4 +52,82 @@ public function test_vcs_abspath_should_report_git_file() {
$this->assertStringContainsString( '' . ABSPATH . '', $result['description'] );
$this->assertStringContainsString( '.git', $result['description'] );
}
+
+ /**
+ * Tests that the test reports a plugin removing wp_version_check() from
+ * its hook on a single site install.
+ *
+ * This is the baseline for
+ * test_wp_version_check_attached_should_report_removed_check_on_main_site().
+ *
+ * @group ms-excluded
+ *
+ * @covers WP_Site_Health_Auto_Updates::test_wp_version_check_attached
+ */
+ public function test_wp_version_check_attached_should_report_removed_check() {
+ remove_action( 'wp_version_check', 'wp_version_check' );
+
+ $health_check = new WP_Site_Health_Auto_Updates();
+ $result = $health_check->test_wp_version_check_attached();
+
+ $this->assertIsArray( $result, 'The test should report the removed version check.' );
+ $this->assertSame( 'fail', $result['severity'] );
+ }
+
+ /**
+ * Tests that the test reports a plugin removing wp_version_check() from
+ * its hook on the main site of a network.
+ *
+ * wp-includes/update.php only hooks wp_version_check() on the main site,
+ * so the test is limited to the main site on multisite (see #52135). It
+ * also requires the network admin, where Site Health has no screen, and
+ * the background updates test runs through the REST API, where
+ * is_network_admin() is false. The test never reports a problem on
+ * multisite as a result.
+ *
+ * @ticket 52135
+ * @group multisite
+ * @group ms-required
+ *
+ * @covers WP_Site_Health_Auto_Updates::test_wp_version_check_attached
+ */
+ public function test_wp_version_check_attached_should_report_removed_check_on_main_site() {
+ $this->assertTrue( is_main_site(), 'The test should run on the main site.' );
+ $this->assertFalse( is_network_admin(), 'Site Health does not run in the network admin.' );
+
+ remove_action( 'wp_version_check', 'wp_version_check' );
+
+ $health_check = new WP_Site_Health_Auto_Updates();
+ $result = $health_check->test_wp_version_check_attached();
+
+ $this->assertIsArray( $result, 'The test should report the removed version check on the main site.' );
+ $this->assertSame( 'fail', $result['severity'] );
+ }
+
+ /**
+ * Tests that the test does not report a missing wp_version_check() hook
+ * on a site other than the main site of a network.
+ *
+ * wp-includes/update.php only hooks wp_version_check() on the main site,
+ * so the hook is always missing on other sites.
+ *
+ * @ticket 52135
+ * @group multisite
+ * @group ms-required
+ *
+ * @covers WP_Site_Health_Auto_Updates::test_wp_version_check_attached
+ */
+ public function test_wp_version_check_attached_should_not_report_on_other_sites() {
+ $site_id = self::factory()->blog->create();
+ switch_to_blog( $site_id );
+
+ remove_action( 'wp_version_check', 'wp_version_check' );
+
+ $health_check = new WP_Site_Health_Auto_Updates();
+ $result = $health_check->test_wp_version_check_attached();
+
+ restore_current_blog();
+
+ $this->assertNull( $result );
+ }
}