Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/phpunit/tests/admin/wpSiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,39 @@ public function test_get_test_opcode_cache_result_by_environment() {
$this->assertStringContainsString( __( 'Enabling this cache can significantly improve the performance of your site.' ), $result['description'] );
}
}

/**
* @ticket 56134
*
* @covers ::get_test_plugin_version
*/
public function test_get_test_plugin_version_with_no_active_plugins() {
update_option( 'active_plugins', array() );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On multisite, is_plugin_active() also counts network-activated plugins, so this relies on active_sitewide_plugins being empty in the test environment. Would it be worth clearing that too when is_multisite(), so the "no active plugins" precondition is explicit in both setups?


$result = $this->instance->get_test_plugin_version();

$this->assertStringContainsString( 'Your site does not have any active plugins.', $result['description'] );
}

/**
* @ticket 56134
*
* @covers ::get_test_theme_version
*/
public function test_get_test_theme_version_with_no_installed_themes() {
$orig_theme_directories = $GLOBALS['wp_theme_directories'];

$GLOBALS['wp_theme_directories'] = array();
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );

$result = $this->instance->get_test_theme_version();

$GLOBALS['wp_theme_directories'] = $orig_theme_directories;
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );

$this->assertSame( 'good', $result['status'] );
$this->assertStringContainsString( 'Your site does not have any installed themes.', $result['description'] );
}
}
Loading