wordpress-develop/tests/phpunit/tests/functions/pluginBasename.php
Dominik Schilling (ocean90) d62141c38d Plugins: In plugin_basename() normalize the file path before unresolving symlinks.
`$wp_plugin_paths` contains normalized paths, see `wp_register_plugin_realpath()`.

Props jdgrimes, voldemortensen, flyingdr, ocean90.
Fixes #29154.

git-svn-id: https://develop.svn.wordpress.org/trunk@37332 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-30 15:08:06 +00:00

28 lines
606 B
PHP

<?php
/**
* Tests for plugin_basename()
*
* @group functions.php
* @group plugins
*/
class Tests_Plugin_Basename extends WP_UnitTestCase {
/**
* @ticket 29154
*/
function test_should_return_correct_basename_for_symlinked_plugins() {
global $wp_plugin_paths;
$old_wp_plugin_paths = $wp_plugin_paths;
$wp_plugin_paths[ WP_PLUGIN_DIR . '/a-symlinked-plugin' ] = 'C:/www/path/plugins/a-plugin';
$basename = plugin_basename( 'c:\www\path\plugins\a-plugin\plugin.php' );
$wp_plugin_paths = $old_wp_plugin_paths;
$this->assertSame( 'a-symlinked-plugin/plugin.php', $basename );
}
}