Skip to content

Commit

Permalink
Add unit test for missing readme header
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Dec 19, 2024
1 parent 03475a8 commit 6e59230
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Contributors: plugin-check
Requires at least: 6.0
Tested up to: 6.1
Requires PHP: 5.6
Stable tag: 1.0.0
License: GPLv2 or later
Expand Down
16 changes: 16 additions & 0 deletions tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@ public function test_run_with_errors_tested_upto() {
$this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'outdated_tested_upto_header' ) ) );
}

public function test_run_with_errors_missing_readme_headers() {
$readme_check = new Plugin_Readme_Check();
$check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-errors-upgrade-notice/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 missing tested upto header.
$this->assertCount( 1, wp_list_filter( $errors['readme.txt'][0][0], array( 'code' => 'missing_readme_header_tested' ) ) );
}

public function test_run_md_with_errors() {
$readme_check = new Plugin_Readme_Check();
$check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-plugin-readme-md-with-errors/load.php' );
Expand Down

0 comments on commit 6e59230

Please sign in to comment.