diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
index f3f91218e..d8496c193 100644
--- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
+++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
@@ -326,7 +326,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse
// Test for a valid SPDX license identifier.
if ( ! $this->is_license_valid_identifier( $license ) ) {
- $this->add_result_warning_for_file(
+ $this->add_result_error_for_file(
$result,
__( 'Your plugin has an invalid license declared.
Please update your readme with a valid SPDX license identifier.', 'plugin-check' ),
'invalid_license',
@@ -371,7 +371,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse
// Check different license types.
if ( ! empty( $plugin_license ) && ! empty( $license ) && $license !== $plugin_license ) {
- $this->add_result_warning_for_file(
+ $this->add_result_error_for_file(
$result,
__( 'Your plugin has a different license declared in the readme file and plugin header.
Please update your readme with a valid GPL license identifier.', 'plugin-check' ),
'license_mismatch',
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 6bbb60c63..d33b7be89 100644
--- a/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php
+++ b/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php
@@ -148,18 +148,18 @@ public function test_run_with_errors_license() {
$readme_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 );
- // Check for invalid license warning.
- $this->assertArrayHasKey( 0, $warnings['readme.txt'] );
- $this->assertArrayHasKey( 0, $warnings['readme.txt'][0] );
- $this->assertCount( 1, wp_list_filter( $warnings['readme.txt'][0][0], array( 'code' => 'invalid_license' ) ) );
+ // Check for invalid license.
+ $this->assertArrayHasKey( 0, $errors['readme.txt'] );
+ $this->assertArrayHasKey( 0, $errors['readme.txt'][0] );
+ $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'invalid_license' ) ) );
- // Check for not same license warning.
- $this->assertCount( 1, wp_list_filter( $warnings['readme.txt'][0][0], array( 'code' => 'license_mismatch' ) ) );
+ // Check for not same license.
+ $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'license_mismatch' ) ) );
}
public function test_run_with_errors_no_license() {
@@ -244,12 +244,12 @@ public function test_run_md_with_errors() {
$this->assertCount( 1, wp_list_filter( $errors['readme.md'][0][0], array( 'code' => 'trunk_stable_tag' ) ) );
$this->assertCount( 1, wp_list_filter( $errors['readme.md'][0][0], array( 'code' => 'outdated_tested_upto_header' ) ) );
$this->assertCount( 1, wp_list_filter( $errors['readme.md'][0][0], array( 'code' => 'default_readme_text' ) ) );
+ $this->assertCount( 1, wp_list_filter( $errors['readme.md'][0][0], array( 'code' => 'invalid_license' ) ) );
+ $this->assertCount( 1, wp_list_filter( $errors['readme.md'][0][0], array( 'code' => 'license_mismatch' ) ) );
$this->assertNotEmpty( $warnings );
$this->assertArrayHasKey( 'readme.md', $warnings );
- $this->assertCount( 1, wp_list_filter( $warnings['readme.md'][0][0], array( 'code' => 'invalid_license' ) ) );
- $this->assertCount( 1, wp_list_filter( $warnings['readme.md'][0][0], array( 'code' => 'license_mismatch' ) ) );
$this->assertCount( 1, wp_list_filter( $warnings['readme.md'][0][0], array( 'code' => 'mismatched_plugin_name' ) ) );
$this->assertCount( 1, wp_list_filter( $warnings['readme.md'][0][0], array( 'code' => 'readme_invalid_contributors' ) ) );
}