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/user/countUserPosts.php

    r35244 r38398  
    2828            'post_type'   => 'wptests_pt',
    2929        ) ) );
    30        
     30
    3131        self::$post_ids[] = $factory->post->create( array(
    3232            'post_author' => 12345,
    3333            'post_type'   => 'wptests_pt',
    3434        ) );
    35     }
    36 
    37     public static function wpTearDownAfterClass() {
    38         self::delete_user( self::$user_id );
    39 
    40         foreach ( self::$post_ids as $post_id ) {
    41             wp_delete_post( $post_id, true );
    42         }
    4335    }
    4436
Note: See TracChangeset for help on using the changeset viewer.