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/canonical/category.php

    r38216 r38398  
    2121        wp_set_post_categories( self::$posts[0], self::$cats[0] );
    2222        wp_set_post_categories( self::$posts[1], self::$cats[1] );
    23     }
    24 
    25     public static function wpTearDownAfterClass() {
    26         foreach ( self::$posts as $post_id ) {
    27             wp_delete_post( $post_id, true );
    28         }
    29 
    30         foreach ( self::$cats as $cat ) {
    31             wp_delete_term( $cat, 'category' );
    32         }
    3323    }
    3424
Note: See TracChangeset for help on using the changeset viewer.