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 `TestCase`s, not just those that implement `wpSetUpBeforeClass` and `wpTearDownAfterClass`
* The tests run 10-20 seconds faster now

See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38398 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2016-08-27 08:35:16 +00:00
parent f0af25bd80
commit 02319efa71
51 changed files with 60 additions and 371 deletions

View File

@@ -25,18 +25,6 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
_unregister_post_status( 'privatefoo' );
}
public static function wpTearDownAfterClass() {
$ids = array( self::$editor_user_id, self::$author_user_id );
foreach ( $ids as $id ) {
self::delete_user( $id );
}
wp_delete_post( self::$editor_private_post, true );
wp_delete_post( self::$author_private_post, true );
wp_delete_post( self::$editor_privatefoo_post, true );
wp_delete_post( self::$author_privatefoo_post, true );
}
public function test_any_should_not_include_statuses_where_exclude_from_search_is_true() {
register_post_status( 'foo', array( 'exclude_from_search' => true ) );