WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/27/2016 08:35:16 AM (4 years ago)
Author:
wonderboymusic
Message:

Unit Tests:

  • Automatically delete objects that we were created during wpSetUpBeforeClass - posts, comments, terms (except 1), and user (except 1)
  • The amount of leftover data between tests was breathtaking - use the new function: _delete_all_data()
  • Commit database transactions for all TestCases, not just those that implement wpSetUpBeforeClass and wpTearDownAfterClass
  • The tests run 10-20 seconds faster now

See #37699.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/postStatus.php

    r35242 r38398  
    2626    }
    2727
    28     public static function wpTearDownAfterClass() {
    29         $ids = array( self::$editor_user_id, self::$author_user_id );
    30         foreach ( $ids as $id ) {
    31             self::delete_user( $id );
    32         }
    33 
    34         wp_delete_post( self::$editor_private_post, true );
    35         wp_delete_post( self::$author_private_post, true );
    36         wp_delete_post( self::$editor_privatefoo_post, true );
    37         wp_delete_post( self::$author_privatefoo_post, true );
    38     }
    39 
    4028    public function test_any_should_not_include_statuses_where_exclude_from_search_is_true() {
    4129        register_post_status( 'foo', array( 'exclude_from_search' => true ) );
Note: See TracChangeset for help on using the changeset viewer.