From a09f4e009d1b2bbfb86b0364e50b85776fd96e4d Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 27 Aug 2024 14:44:25 -0600 Subject: [PATCH] add test for output compatibility status table --- tests/phpunit/test-compatibility-layer.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/phpunit/test-compatibility-layer.php b/tests/phpunit/test-compatibility-layer.php index c47071e..eaa3f0a 100644 --- a/tests/phpunit/test-compatibility-layer.php +++ b/tests/phpunit/test-compatibility-layer.php @@ -87,4 +87,25 @@ public function test_daily_pantheon_cron() { $this->assertIsArray( $applied_fixes ); $this->assertArrayHasKey( 'wp-force-login/wp-force-login.php', $applied_fixes ); } + + public function test_output_compatibility_status_table() { + $plugins = get_option( 'active_plugins' ); + foreach ( [ 'tuxedo-big-file-uploads/tuxedo_big_file_uploads.php', 'phastpress/phastpress.php' ] as $plugin ) { + $plugins[] = $plugin; + } + update_option( 'active_plugins', $plugins ); + wp_cache_delete( 'plugins', 'plugins' ); + + $manual_fixes = Pantheon\Site_Health\get_compatibility_manual_fixes(); + $review_fixes = Pantheon\Site_Health\get_compatibility_review_fixes(); + + $manual_table = Pantheon\Site_Health\output_compatibility_status_table( $manual_fixes, false ); + + $this->assertStringContainsString( 'Big-file-uploads', $manual_table ); + $this->assertStringContainsString( 'Manual Fix Required', $manual_table ); + + $review_table = Pantheon\Site_Health\output_compatibility_status_table( $review_fixes, false, true ); + $this->assertStringContainsString( 'Phastpress', $review_table ); + $this->assertStringContainsString( 'Incompatible', $review_table ); + } }