From 75533a5d409b6fcd69aed1985504dc4cb91bb9e7 Mon Sep 17 00:00:00 2001 From: davidperezgar Date: Wed, 8 Jan 2025 23:20:56 +0100 Subject: [PATCH] updated tests with error names --- includes/Checker/Checks/Plugin_Repo/File_Type_Check.php | 2 +- .../phpunit/tests/Checker/Checks/File_Type_Check_Tests.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/File_Type_Check.php b/includes/Checker/Checks/Plugin_Repo/File_Type_Check.php index e750ce75..247fb3e1 100644 --- a/includes/Checker/Checks/Plugin_Repo/File_Type_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/File_Type_Check.php @@ -320,7 +320,7 @@ function ( $file ) use ( $plugin_path ) { $this->add_result_error_for_file( $result, __( 'Case-Sensitive duplicated folders were found. They\'ll be problematic in different systems.', 'plugin-check' ), - 'duplicated_folders', + 'case_sensitive_folders', implode( ', ', $case_sensitive_folders ), 0, 0, diff --git a/tests/phpunit/tests/Checker/Checks/File_Type_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/File_Type_Check_Tests.php index 2ebded8f..cb7bfbe3 100644 --- a/tests/phpunit/tests/Checker/Checks/File_Type_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/File_Type_Check_Tests.php @@ -128,7 +128,7 @@ public function test_run_with_badly_named_errors() { $this->assertCount( 1, wp_list_filter( $errors['badly|file%name!@#$%^&*()+=[]{};:"\'<>,?|`~.php'][0][0], array( 'code' => 'badly_named_files' ) ) ); } - public function test_run_with_duplicated_named_errors() { + public function test_run_with_case_sensitive_named_errors() { // Initialize the Check_Context with a plugin path that mimics the directory structure. $check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-file-type-badly-named-files-errors/load.php' ); @@ -155,7 +155,7 @@ public function test_run_with_duplicated_named_errors() { $errors = $check_result->get_errors(); - $this->assertCount( 1, wp_list_filter( $errors['custom-file.php'][0][0], array( 'code' => 'duplicated_files' ) ) ); + $this->assertCount( 1, wp_list_filter( $errors['custom-file.php'][0][0], array( 'code' => 'case_sensitive_files' ) ) ); // Define the custom file list with duplicate folder names as they would appear in a plugin directory. $custom_files = array( @@ -167,7 +167,7 @@ public function test_run_with_duplicated_named_errors() { $result = $check_files_method->invoke( $check, $check_result, $custom_files ); $errors = $check_result->get_errors(); - $this->assertCount( 1, wp_list_filter( $errors['sub directory/'][0][0], array( 'code' => 'duplicated_folders' ) ) ); + $this->assertCount( 1, wp_list_filter( $errors['sub directory/'][0][0], array( 'code' => 'case_sensitive_folders' ) ) ); } public function test_run_with_library_core_errors() {