Changeset 11739
- Timestamp:
- 11/03/2017 09:11:52 PM (8 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r11736 r11739 26 26 protected $deactivated_components = array(); 27 27 28 /** 29 * Cribbed from WP so that the self::factory() call comes from this class. 30 * 31 * @since 3.0.0 32 */ 28 33 public static function setUpBeforeClass() { 34 global $wpdb; 29 35 30 36 // Fake WP mail globals, to avoid errors … … 32 38 add_filter( 'wp_mail_from', array( 'BP_UnitTestCase', 'tearDown_wp_mail' ) ); 33 39 34 parent::setUpBeforeClass(); 40 $c = self::get_called_class(); 41 if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { 42 self::commit_transaction(); 43 return; 44 } 45 46 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() ); 47 48 self::commit_transaction(); 35 49 } 36 50 … … 92 106 } 93 107 $this->deactivated_components = array(); 108 } 109 110 /** 111 * Multisite-agnostic way to delete a user from the database. 112 * 113 * @since 3.0.0 114 */ 115 public static function delete_user( $user_id ) { 116 $deleted = parent::delete_user( $user_id ); 117 118 // When called in tearDownAfterClass(), BP's cleanup functions may no longer be hooked. 119 if ( bp_is_active( 'activity' ) ) { 120 bp_activity_remove_all_user_data( $user_id ); 121 } 122 123 return $deleted; 94 124 } 95 125 -
trunk/tests/phpunit/testcases/core/class-bp-media-extractor.php
r11737 r11739 8 8 public static $richtext = ''; 9 9 10 11 public static function setUpBeforeClass() { 12 parent::setUpBeforeClass(); 13 10 public static function wpSetUpBeforeClass( $f ) { 14 11 self::$media_extractor = new BP_Media_Extractor(); 15 12 self::$richtext = "Hello world. -
trunk/tests/phpunit/testcases/core/suggestions-nonauth.php
r9819 r11739 11 11 protected static $user_ids = array(); 12 12 13 public static function setUpBeforeClass() { 14 parent::setUpBeforeClass(); 15 13 public static function wpSetUpBeforeClass( $factory ) { 16 14 $users = array( 17 15 // user_login, display_name … … 28 26 array( 'zoom', 'Lisa Smithy' ), 29 27 ); 30 31 $factory = new BP_UnitTest_Factory();32 28 33 29 // Create some dummy users. -
trunk/tests/phpunit/testcases/core/suggestions.php
r11256 r11739 13 13 protected static $user_ids = array(); 14 14 15 public static function setUpBeforeClass() { 16 parent::setUpBeforeClass(); 17 18 $factory = new BP_UnitTest_Factory(); 19 15 public static function wpSetUpBeforeClass( $factory ) { 20 16 self::$old_user_id = get_current_user_id(); 21 17 self::$current_user = $factory->user->create( array( -
trunk/tests/phpunit/testcases/groups/functions/bpGetUserGroups.php
r10794 r11739 14 14 } 15 15 16 public static function setUpBeforeClass() {16 public static function wpSetUpBeforeClass( $f ) { 17 17 $f = new BP_UnitTest_Factory(); 18 18 -
trunk/tests/phpunit/testcases/groups/functions/groupsCreateGroup.php
r11737 r11739 11 11 public static function wpSetUpBeforeClass( $factory ) { 12 12 self::$user_id = $factory->user->create(); 13 } 14 15 public static function wpTearDownAfterClass() { 16 self::delete_user( self::$user_id ); 13 17 } 14 18 -
trunk/tests/phpunit/testcases/groups/functions/groupsIsUser.php
r10794 r11739 11 11 static $groups; 12 12 13 public static function setUpBeforeClass() { 14 $f = new BP_UnitTest_Factory(); 15 13 public static function wpSetUpBeforeClass( $f ) { 16 14 self::$user = $f->user->create( array( 17 15 'user_login' => 'groups_is_user', -
trunk/tests/phpunit/testcases/groups/types.php
r11737 r11739 14 14 } 15 15 16 public static function setUpBeforeClass() { 17 $f = new BP_UnitTest_Factory(); 18 16 public static function wpSetUpBeforeClass( $f ) { 19 17 self::$u1 = $f->user->create( array( 20 18 'user_email' => 'group-types-tests@example.com', … … 23 21 } 24 22 25 public static function tearDownAfterClass() { 26 if ( is_multisite() ) { 27 wpmu_delete_user( self::$u1 ); 28 } else { 29 wp_delete_user( self::$u1 ); 30 } 23 public static function wpTearDownAfterClass() { 24 self::delete_user( self::$u1 ); 31 25 } 32 26
Note: See TracChangeset
for help on using the changeset viewer.