Make WordPress Core


Ignore:
Timestamp:
08/27/2016 08:35:16 AM (8 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/capabilities.php

    r38096 r38398  
    1919            'subscriber'    => $factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
    2020        );
    21     }
    22 
    23     public static function wpTearDownAfterClass() {
    24         foreach ( self::$users as $role => $user ) {
    25             self::delete_user( $user->ID );
    26         }
    2721    }
    2822
     
    11921186        foreach ( $caps as $cap => $roles ) {
    11931187            $this->assertFalse( current_user_can( $cap ), "Non-logged-in user should not have the {$cap} capability" );
    1194         }       
     1188        }
    11951189
    11961190    }
Note: See TracChangeset for help on using the changeset viewer.