From 2ce79b0255a4ee231c0ba7f2506c0bd7cf17a4a3 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Fri, 6 Dec 2024 11:09:51 +0100 Subject: [PATCH] reverted tests and updated escaped default --- includes/Checker/Checks/General/I18n_Usage_Check.php | 2 +- .../phpunit/tests/Checker/Checks/I18n_Usage_Check_Tests.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Checker/Checks/General/I18n_Usage_Check.php b/includes/Checker/Checks/General/I18n_Usage_Check.php index eaba6541e..f7200f30b 100644 --- a/includes/Checker/Checks/General/I18n_Usage_Check.php +++ b/includes/Checker/Checks/General/I18n_Usage_Check.php @@ -99,7 +99,7 @@ public function get_documentation_url(): string { */ protected function add_result_message_for_file( Check_Result $result, $error, $message, $code, $file, $line = 0, $column = 0, string $docs = '', $severity = 5 ) { // Downgrade errors about usage of the 'default' text domain from WordPress Core to warnings. - if ( $error && str_ends_with( $message, " but got 'default'." ) ) { + if ( $error && str_ends_with( $message, " but got 'default'." ) ) { $error = false; } diff --git a/tests/phpunit/tests/Checker/Checks/I18n_Usage_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/I18n_Usage_Check_Tests.php index c8540365f..cf53b5544 100644 --- a/tests/phpunit/tests/Checker/Checks/I18n_Usage_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/I18n_Usage_Check_Tests.php @@ -58,8 +58,8 @@ public function test_run_without_default_textdomain() { // Explicitly using the 'default' text domain is a warning, omitting a text domain is an error. $this->assertNotEmpty( $check_result->get_errors() ); - $this->assertEmpty( $check_result->get_warnings() ); - $this->assertEquals( 2, $check_result->get_error_count() ); - $this->assertEquals( 0, $check_result->get_warning_count() ); + $this->assertNotEmpty( $check_result->get_warnings() ); + $this->assertEquals( 1, $check_result->get_error_count() ); + $this->assertEquals( 1, $check_result->get_warning_count() ); } }