diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
index 8e9ea089..71ee0e53 100644
--- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
+++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
@@ -354,7 +354,7 @@ private function check_license( Check_Result $result, string $readme_file, Parse
}
// Checks for a valid license in Plugin Header.
- if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat|Apache/im', $plugin_license ) ) {
+ if ( ! empty( $plugin_license ) && ! preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat|Apache|MPL20/im', $plugin_license ) ) {
$this->add_result_error_for_file(
$result,
__( 'Your plugin has an invalid license declared in Plugin Header.
Please update your readme with a valid GPL license identifier. It is necessary to declare the license of this plugin. You can do this by using the fields available both in the plugin readme and in the plugin headers.', 'plugin-check' ),
diff --git a/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-mpl1-license-with-errors/load.php b/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-mpl1-license-with-errors/load.php
new file mode 100644
index 00000000..34a6c3c6
--- /dev/null
+++ b/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-mpl1-license-with-errors/load.php
@@ -0,0 +1,16 @@
+assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'no_license' ) ) );
}
+ public function test_run_without_error_mpl2_license() {
+ $readme_check = new Plugin_Readme_Check();
+ $check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-mpl2-license-without-errors/load.php' );
+ $check_result = new Check_Result( $check_context );
+
+ $readme_check->run( $check_result );
+
+ $errors = $check_result->get_errors();
+
+ $this->assertEmpty( $errors );
+ }
+
+ public function test_run_with_errors_mpl1_license() {
+ $readme_check = new Plugin_Readme_Check();
+ $check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-mpl1-license-with-errors/load.php' );
+ $check_result = new Check_Result( $check_context );
+
+ $readme_check->run( $check_result );
+
+ $errors = $check_result->get_errors();
+
+ $this->assertNotEmpty( $errors );
+ $this->assertArrayHasKey( 'load.php', $errors );
+
+ // Check for invalid license.
+ $this->assertArrayHasKey( 0, $errors['load.php'] );
+ $this->assertArrayHasKey( 0, $errors['load.php'][0] );
+ $this->assertCount( 1, wp_list_filter( $errors['load.php'][0][0], array( 'code' => 'invalid_license' ) ) );
+ }
+
public function test_run_with_errors_tested_upto() {
$readme_check = new Plugin_Readme_Check();
$check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-errors-tested-upto/load.php' );