Skip to content

Commit 5429a9a

Browse files
authored
Merge pull request #933 from WordPress/930-severity-missing-readme-headers
Upgrade severity for missing readme headers
2 parents 81f5830 + 8b343c7 commit 5429a9a

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ private function check_headers( Check_Result $result, string $readme_file, Parse
288288
$readme_file,
289289
0,
290290
0,
291-
'https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/#readme-header-information'
291+
'https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/#readme-header-information',
292+
7
292293
);
293294
}
294295
}

tests/phpunit/testdata/plugins/test-plugin-plugin-readme-errors-upgrade-notice/readme.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
=== Test Plugin with readme ===
22

3-
Contributors: plugin-check
43
Requires at least: 6.0
54
Requires PHP: 5.6
65
Stable tag: 1.0.0

tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ public function test_run_with_errors_tested_upto_minor_different_major_version()
272272
}
273273

274274
public function test_run_with_errors_missing_readme_headers() {
275+
add_filter( 'wp_plugin_check_ignored_readme_warnings', '__return_empty_array' );
276+
275277
$readme_check = new Plugin_Readme_Check();
276278
$check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-errors-upgrade-notice/load.php' );
277279
$check_result = new Check_Result( $check_context );
@@ -280,11 +282,20 @@ public function test_run_with_errors_missing_readme_headers() {
280282

281283
$errors = $check_result->get_errors();
282284

285+
remove_filter( 'wp_plugin_check_ignored_readme_warnings', '__return_empty_array' );
286+
283287
$this->assertNotEmpty( $errors );
284288
$this->assertArrayHasKey( 'readme.txt', $errors );
285289

286290
// Check for missing tested upto header.
287-
$this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'missing_readme_header_tested' ) ) );
291+
$tested_upto_error = array_values( wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'missing_readme_header_tested' ) ) );
292+
$this->assertCount( 1, $tested_upto_error );
293+
$this->assertSame( 7, $tested_upto_error[0]['severity'] );
294+
295+
// Check for missing contributors header.
296+
$contributors_error = array_values( wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'missing_readme_header_contributors' ) ) );
297+
$this->assertCount( 1, $contributors_error );
298+
$this->assertSame( 7, $contributors_error[0]['severity'] );
288299
}
289300

290301
public function test_run_md_with_errors() {

0 commit comments

Comments
 (0)