WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/10/2017 05:33:57 AM (8 months ago)
Author:
pento
Message:

File Editor: Add support for more than one sub-directory level.

The theme and plugin editors now list all files in the selected theme or plugin, recursing through subdirectories as necessary.

Props WraithKenny, schlessera, chsxf, MikeHansenMe, Daedalon, valendesigns, westonruter, pento.
Fixes #6531.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r35242 r41806  
    9595
    9696    /**
     97     * @covers ::get_plugin_files
     98     */
     99    public function test_get_plugin_files_folder() {
     100        $plugin_dir = WP_PLUGIN_DIR . '/list_files_test_plugin';
     101        @mkdir( $plugin_dir );
     102        $plugin = $this->_create_plugin(null, 'list_files_test_plugin.php', $plugin_dir );
     103
     104        $sub_dir = trailingslashit( dirname( $plugin[1] ) ) . 'subdir';
     105        @mkdir( $sub_dir );
     106        @file_put_contents( $sub_dir . '/subfile.php', '<?php // Silence.' );
     107
     108        $plugin_files = get_plugin_files( plugin_basename( $plugin[1] ) );
     109        $expected = array(
     110            'list_files_test_plugin/list_files_test_plugin.php',
     111            'list_files_test_plugin/subdir/subfile.php',
     112        );
     113        $this->assertEquals( $expected, $plugin_files );
     114
     115        unlink( $sub_dir . '/subfile.php' );
     116        unlink( $plugin[1] );
     117        rmdir( $sub_dir );
     118        rmdir( $plugin_dir );
     119    }
     120
     121    /**
    97122     * @covers ::get_mu_plugins
    98123     */
Note: See TracChangeset for help on using the changeset viewer.