Tests: Revert removing empty directory in WP_UnitTestCase_Base::rmdir() for now.

This appears to need more investigation. Instead, delete the `test-plugin` and `link-manager` directories in REST API plugins controller tests, for which this change was initially intended.

Follow-up to [54300], [54301], [54303].

See #55652, #56629.

git-svn-id: https://develop.svn.wordpress.org/trunk@54304 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-09-25 04:47:02 +00:00
parent e7b4945e9d
commit 8f3254d794
3 changed files with 8 additions and 13 deletions
@@ -1350,29 +1350,16 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
* Does not delete files if their paths are set in the `$ignore_files` property.
*
* @since 4.0.0
* @since 6.1.0 Removes the empty directory if there are no files left.
*
* @param string $path Directory path.
*/
public function rmdir( $path ) {
if ( ! is_dir( $path ) ) {
return;
}
$files = $this->files_in_dir( $path );
foreach ( $files as $file ) {
if ( ! in_array( $file, self::$ignore_files, true ) ) {
$this->unlink( $file );
}
}
/*
* If there were no ignored files, remove the empty directory.
* If there are any nested empty directories, remove them too.
*/
if ( ! array_intersect( $files, self::$ignore_files ) ) {
$this->delete_folders( $path );
}
}
/**