From 1d5c7095f62b4ca9dde42b169e25bfc4b431aa24 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 9 Sep 2024 16:19:06 +0545 Subject: [PATCH] Test realpath --- includes/Plugin_Context.php | 2 ++ tests/behat/features/plugin-check-remote.feature | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/includes/Plugin_Context.php b/includes/Plugin_Context.php index e0c4923a8..35589abb3 100644 --- a/includes/Plugin_Context.php +++ b/includes/Plugin_Context.php @@ -57,6 +57,8 @@ public function __construct( $main_file ) { ); } + $this->main_file = realpath( $this->main_file ); + if ( false === strpos( $this->main_file, '.php' ) ) { $files = glob( $this->main_file . '/*.php' ); foreach ( $files as $file ) { diff --git a/tests/behat/features/plugin-check-remote.feature b/tests/behat/features/plugin-check-remote.feature index 6499f0663..4f1040a61 100644 --- a/tests/behat/features/plugin-check-remote.feature +++ b/tests/behat/features/plugin-check-remote.feature @@ -35,6 +35,10 @@ Feature: Test that the WP-CLI plugin check command works with remote ZIP url. Scenario: Test with valid ZIP When I run the WP-CLI command `plugin check https://github.com/WordPress/plugin-check/raw/trunk/tests/behat/testdata/foo-bar-wp.zip --fields=code,type --format=csv` Then STDOUT should contain: + """ + FILE: foo-bar-wp.php + """ + And STDOUT should contain: """ WordPress.WP.AlternativeFunctions.rand_mt_rand,ERROR """