Skip to content

Commit

Permalink
Update test for special chars
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Sep 19, 2024
1 parent f9ffc34 commit 668ac74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ private function check_name( Check_Result $result, string $readme_file, Parser $
$plugin_readme_name = html_entity_decode( $parser->name, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 );
$plugin_header_name = html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 );

if ( $plugin_name_readme !== $plugin_header_name ) {
if ( $plugin_readme_name !== $plugin_header_name ) {
$this->add_result_warning_for_file(
$result,
sprintf(
/* translators: 1: Plugin name, 2: Name in plugin header */
__( 'Plugin name "%1$s" is different from the name declared in plugin header "%2$s".', 'plugin-check' ),
$plugin_name_readme,
$plugin_readme_name,
$plugin_header_name

Check warning on line 162 in includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php#L161-L162

Added lines #L161 - L162 were not covered by tests
),
'mismatched_plugin_name',
Expand Down
6 changes: 3 additions & 3 deletions tests/behat/features/plugin-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ Feature: Test that the WP-CLI command works.
WordPress.Security.EscapeOutput.OutputNotEscaped
"""

Scenario: Check plugin with apostrophe in plugin name
Scenario: Check plugin with special chars in plugin name
Given a WP install with the Plugin Check plugin
And a wp-content/plugins/johns-post-counter/johns-post-counter.php file:
"""
<?php
/**
* Plugin Name: John's Post Counter
* Plugin Name: John's Post & Counter
*/
"""
And a wp-content/plugins/johns-post-counter/readme.txt file:
"""
=== John's Post Counter ===
=== John's Post & Counter ===
"""

When I run the WP-CLI command `plugin check johns-post-counter --format=csv --fields=code,type`
Expand Down

0 comments on commit 668ac74

Please sign in to comment.