Make WordPress Core

Changeset 677 in tests for wp-testlib/base.php


Ignore:
Timestamp:
04/12/2012 05:02:12 PM (14 years ago)
Author:
nacin
Message:

Introduce a _destroy_uploads() method for WPTestCase to wipe the uploads folder when appropriate. Additional tests may need to call this still. props kurtypayne, see #33.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testlib/base.php

    r675 r677  
    409409    }
    410410
     411    function _destroy_uploads() {
     412        $uploads = wp_upload_dir();
     413        foreach ( scandir( $uploads['basedir'] ) as $file )
     414            _rmdir( $uploads['basedir'] . '/' . $file );
     415    }
     416
    411417    /**
    412418     * Checks if track ticket #$ticket_id is resolved
     
    647653        wp_ob_end_flush_all();
    648654        parent::tearDown();
    649         // delete any users that were created during tests
     655        // delete any users and uploads that were created during tests
    650656        $this->_destroy_users();
     657        $this->_destroy_uploads();
    651658
    652659        remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
Note: See TracChangeset for help on using the changeset viewer.