wordpress-develop/tests/phpunit/tests/functions/listFiles.php
Gary Pendergast 33a0ff50b7 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.



git-svn-id: https://develop.svn.wordpress.org/trunk@41806 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-10 05:33:57 +00:00

21 lines
626 B
PHP

<?php
/**
* Test list_files().
*
* @group functions.php
*/
class Tests_Functions_ListFiles extends WP_UnitTestCase {
public function test_list_files_returns_a_list_of_files() {
$admin_files = list_files( ABSPATH . 'wp-admin/' );
$this->assertInternalType( 'array', $admin_files );
$this->assertNotEmpty( $admin_files );
$this->assertContains( ABSPATH . 'wp-admin/index.php', $admin_files );
}
public function test_list_files_can_exclude_files() {
$admin_files = list_files( ABSPATH . 'wp-admin/', 100, array( 'index.php' ) );
$this->assertNotContains( ABSPATH . 'wp-admin/index.php', $admin_files );
}
}