Skip to content

Commit 8b343c7

Browse files
committed
Add test for missing Contributors readme header
1 parent 38ba923 commit 8b343c7

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

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

Lines changed: 12 additions & 3 deletions
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,13 +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-
$tested_error = wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'missing_readme_header_tested' ) );
288-
$this->assertCount( 1, $tested_error );
289-
$this->assertSame( 7, $tested_error[0]['severity'] );
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'] );
290299
}
291300

292301
public function test_run_md_with_errors() {

0 commit comments

Comments
 (0)