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/query.php

    r37360 r38398  
    3434            'role' => 'administrator',
    3535        ) );
    36     }
    37 
    38     public static function wpTearDownAfterClass() {
    39         $sets = array(
    40             self::$author_ids,
    41             self::$sub_ids,
    42             self::$editor_ids,
    43             array( self::$contrib_id ),
    44             self::$admin_ids
    45         );
    46 
    47         foreach ( $sets as $set ) {
    48             foreach ( $set as $id ) {
    49                 self::delete_user( $id );
    50             }
    51         }
    5236    }
    5337
Note: See TracChangeset for help on using the changeset viewer.