Skip to content

Commit f30c1b9

Browse files
committed
Test realpath
1 parent 9d72214 commit f30c1b9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

includes/Plugin_Context.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ public function main_file() {
101101
*/
102102
public function path( $relative_path = '/' ) {
103103
if ( is_dir( $this->main_file ) ) {
104-
return trailingslashit( $this->main_file ) . ltrim( $relative_path, '/' );
104+
return realpath( trailingslashit( $this->main_file ) . ltrim( $relative_path, '/' ) ) . '/';
105105
} else {
106-
return plugin_dir_path( $this->main_file ) . ltrim( $relative_path, '/' );
106+
return realpath( plugin_dir_path( $this->main_file ) . ltrim( $relative_path, '/' ) ) . '/';
107107
}
108108
}
109109

tests/behat/features/plugin-check-remote.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Feature: Test that the WP-CLI plugin check command works with remote ZIP url.
3535
Scenario: Test with valid ZIP
3636
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`
3737
Then STDOUT should contain:
38+
"""
39+
FILE: foo-bar-wp.php
40+
"""
41+
And STDOUT should contain:
3842
"""
3943
WordPress.WP.AlternativeFunctions.rand_mt_rand,ERROR
4044
"""

0 commit comments

Comments
 (0)