From 90a6da0d49fa12dbd17b51fa4d6080a86cf4fe59 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 3 Feb 2025 11:33:52 +0545 Subject: [PATCH] Make check for requires headers an error --- .../Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php | 5 ++--- .../tests/Checker/Checks/Plugin_Readme_Check_Tests.php | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 67c537e7..5d32c1be 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -835,7 +835,7 @@ private function check_requires_headers( Check_Result $result, string $readme_fi $plugin_value = $plugin_data[ $requires[ $require ]['header_field'] ]; if ( $readme_value !== $plugin_value ) { - $this->add_result_warning_for_file( + $this->add_result_error_for_file( $result, sprintf( /* translators: 1: readme header tag, 2: versions comparison */ @@ -847,8 +847,7 @@ private function check_requires_headers( Check_Result $result, string $readme_fi $readme_file, 0, 0, - 'https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/#readme-header-information', - 6 + 'https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/#readme-header-information' ); } } diff --git a/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php index f5873cc9..475c5c1f 100644 --- a/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php @@ -549,12 +549,12 @@ public function test_run_with_mismatched_requires_headers() { $check->run( $check_result ); - $warnings = $check_result->get_warnings(); + $errors = $check_result->get_errors(); - $this->assertNotEmpty( $warnings ); - $this->assertArrayHasKey( 'readme.txt', $warnings ); + $this->assertNotEmpty( $errors ); + $this->assertArrayHasKey( 'readme.txt', $errors ); - $this->assertCount( 1, wp_list_filter( $warnings['readme.txt'][0][0], array( 'code' => 'readme_mismatched_header_requires' ) ) ); - $this->assertCount( 1, wp_list_filter( $warnings['readme.txt'][0][0], array( 'code' => 'readme_mismatched_header_requires_php' ) ) ); + $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'readme_mismatched_header_requires' ) ) ); + $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'readme_mismatched_header_requires_php' ) ) ); } }