/**
  * Teardown this test case
  */
 function tearDown()
 {
     // Remove any remaining test files
     wp_rmdir_recursive('test://');
     // Unregister test stream wrapper
     WP_Stream_Wrapper_Registry::unregister_wrapper('test');
 }
/**
 * Removes directory recursively
 *
 * IMPORTANT: This function is experimental and has not been tested.
 *
 * Attempts to remove the given directory recursively. Unlike PHP's rmdir()
 * which only removes the directory if it's empty, wp_rmdir_recursive() will
 * try to recursively delete all files and directories. Essentially this is
 * equivalent to a "rm -rf" command, or a forced rmdir() if you will.
 *
 * @param string $uri
 *   the URI or path to file.
 *
 * @return bool
 *   true on success or false on failure.
 *
 * @link    http://us2.php.net/manual/en/function.rmdir.php
 * @see     rmdir()
 * @since   1.0.0
 */
function wp_rmdir_recursive($uri)
{
    $path = wp_realpath($uri);
    $path = rtrim($path, "/");
    $objects = glob($path . '/*', GLOB_MARK);
    foreach ($objects as $object) {
        if (is_dir($object)) {
            wp_rmdir_recursive($object);
        } else {
            unlink($object);
        }
    }
    if (is_dir($path)) {
        return rmdir($path);
    }
    return true;
}