diff --git a/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-errors-invalid-name/readme.txt b/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-errors-invalid-name/readme.txt index 3ef42ac7e..8e51072da 100644 --- a/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-errors-invalid-name/readme.txt +++ b/tests/phpunit/testdata/plugins/test-plugin-plugin-readme-errors-invalid-name/readme.txt @@ -1,6 +1,6 @@ === Plugin Name === -Contributors: plugin-check +Contributors: plugin-check, username Requires at least: 6.0 Tested up to: 6.1 Requires PHP: 5.6 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 a478c22f6..fbf0ae2f3 100644 --- a/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php @@ -68,6 +68,22 @@ public function test_run_with_errors_invalid_name() { $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'invalid_plugin_name' ) ) ); } + public function test_run_with_errors_restricted_contributors() { + $readme_check = new Plugin_Readme_Check(); + $check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-errors-invalid-name/load.php' ); + $check_result = new Check_Result( $check_context ); + + $readme_check->run( $check_result ); + + $errors = $check_result->get_errors(); + + $this->assertNotEmpty( $errors ); + $this->assertArrayHasKey( 'readme.txt', $errors ); + + // Check for restricted contributors error. + $this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'readme_restricted_contributors' ) ) ); + } + public function test_run_with_errors_empty_name() { $readme_check = new Plugin_Readme_Check(); $check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-errors-empty-name/load.php' );