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/admin/includesComment.php

    r38372 r38398  
    4343
    4444    /**
    45      * Delete the post and comments for the tests.
    46      */
    47     public static function wpTearDownAfterClass() {
    48         foreach ( self::$comment_ids as $comment_id ) {
    49             wp_delete_comment( $comment_id, true );
    50         }
    51 
    52         wp_delete_post( self::$post_id, true );
    53     }
    54 
    55     /**
    5645     * Verify that both the comment date and author must match for a comment to exist.
    5746     */
Note: See TracChangeset for help on using the changeset viewer.