File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Plugin Name: Test Header fields with errors
4+ * Plugin URI: https://example.com/sample-link
5+ * Description: Here is a short description of the plugin.
6+ * Requires at least: Recent version
7+ * Requires PHP: Latest version
8+ * Author: WordPress Performance Team
9+ * Author URI: https://http://example.com/
10+ * Text Domain: test-mismathed-textdomain-here
11+ * Domain Path: /nonexistent-folder
12+ * Network: random-value
13+ * GitHub Plugin URI: johndoe/package
14+ * Requires Plugins: Example Plugin, OtherPlugin
15+ *
16+ * @package test-plugin-header-fields-with-errors
17+ */
Original file line number Diff line number Diff line change @@ -167,4 +167,20 @@ public function test_run_without_errors_requires_at_least_latest_version() {
167167
168168 $ this ->assertEmpty ( $ errors );
169169 }
170+
171+ public function test_run_with_errors_duplicated_protocol_is_valid_url () {
172+ $ check = new Plugin_Header_Fields_Check ();
173+ $ check_context = new Check_Context ( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-header-fields-duplicated-protocol-with-errors/load.php ' );
174+ $ check_result = new Check_Result ( $ check_context );
175+
176+ $ check ->run ( $ check_result );
177+
178+ $ errors = $ check_result ->get_errors ();
179+
180+ $ filtered_items = wp_list_filter ( $ errors ['load.php ' ][0 ][0 ], array ( 'code ' => 'plugin_header_invalid_author_uri ' ) );
181+
182+ $ this ->assertCount ( 1 , $ filtered_items );
183+ $ this ->assertStringContainsString ( 'Author URI ' , $ filtered_items [1 ]['message ' ] );
184+ $ this ->assertStringContainsString ( 'is not valid ' , $ filtered_items [1 ]['message ' ] );
185+ }
170186}
You can’t perform that action at this time.
0 commit comments