Changeset 37983
- Timestamp:
- 07/06/2016 09:44:58 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/plugin.php
r37911 r37983 732 732 $file = wp_normalize_path( $file ); 733 733 734 arsort( $wp_plugin_paths ); 734 735 foreach ( $wp_plugin_paths as $dir => $realdir ) { 735 736 if ( strpos( $file, $realdir ) === 0 ) { -
trunk/tests/phpunit/tests/functions/pluginBasename.php
r37719 r37983 10 10 11 11 /** 12 * @var array 13 */ 14 protected $wp_plugin_paths_backup; 15 16 /** 17 * Normalized path to plugin directory. 18 * 19 * @var string 20 */ 21 protected $wp_plugin_path; 22 23 public function setUp() { 24 parent::setUp(); 25 26 $this->wp_plugin_paths_backup = $GLOBALS['wp_plugin_paths']; 27 $this->wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR ); 28 } 29 30 public function tearDown() { 31 $GLOBALS['wp_plugin_paths'] = $this->wp_plugin_paths_backup; 32 33 parent::tearDown(); 34 } 35 36 /** 12 37 * @ticket 29154 13 38 */ 14 function test_ should_return_correct_basename_for_symlinked_plugins() {39 function test_return_correct_basename_for_symlinked_plugins() { 15 40 global $wp_plugin_paths; 16 41 17 $ old_wp_plugin_paths = $wp_plugin_paths;18 19 $wp_plugin_paths[ wp_normalize_path( WP_PLUGIN_DIR ) . '/a-symlinked-plugin' ] = 'C:/www/path/plugins/a-plugin';42 $wp_plugin_paths = array( 43 $this->wp_plugin_path . '/a-symlinked-plugin' => 'C:/www/path/plugins/a-plugin', 44 ); 20 45 21 46 $basename = plugin_basename( 'c:\www\path\plugins\a-plugin\plugin.php' ); 22 23 $wp_plugin_paths = $old_wp_plugin_paths;24 25 47 $this->assertSame( 'a-symlinked-plugin/plugin.php', $basename ); 26 48 } 49 50 /** 51 * @ticket 28441 52 */ 53 function test_return_correct_basename_for_symlinked_plugins_with_path_conflicts() { 54 global $wp_plugin_paths; 55 56 $wp_plugin_paths = array( 57 $this->wp_plugin_path . '/plugin' => '/Users/me/Dropbox/Development/Repositories/plugin', 58 $this->wp_plugin_path . '/trunk' => '/Users/me/Dropbox/Development/Repositories/plugin/trunk', 59 ); 60 61 $basename = plugin_basename( '/Users/me/Dropbox/Development/Repositories/plugin/trunk/plugin.php' ); 62 $this->assertSame( 'trunk/plugin.php', $basename ); 63 } 27 64 }
Note: See TracChangeset
for help on using the changeset viewer.