Skip to content

Commit

Permalink
Use self::delete_user() instead of individual delete user conditional…
Browse files Browse the repository at this point in the history
…s in PHPUnit tests.
  • Loading branch information
felixarntz committed Aug 9, 2024
1 parent 4d8052b commit 1700958
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 30 deletions.
6 changes: 1 addition & 5 deletions tests/phpunit/tests/Admin_Pages/Admin_Menu_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
}

public static function wpTearDownAfterClass() {
if ( is_multisite() ) {
wpmu_delete_user( self::$admin_id );
} else {
wp_delete_user( self::$admin_id );
}
self::delete_user( self::$admin_id );
}

public function set_up() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
}

public static function wpTearDownAfterClass() {
if ( is_multisite() ) {
wpmu_delete_user( self::$admin_id );
} else {
wp_delete_user( self::$admin_id );
}
self::delete_user( self::$admin_id );
}

public function set_up() {
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/tests/Entities/User_Query_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {

public static function wpTearDownAfterClass() {
foreach ( self::$users as $user_id ) {
if ( is_multisite() ) {
wpmu_delete_user( $user_id );
} else {
wp_delete_user( $user_id );
}
self::delete_user( $user_id );
}
}

Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/tests/Entities/User_Repository_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
}

public static function wpTearDownAfterClass() {
if ( is_multisite() ) {
wpmu_delete_user( self::$user_id );
} else {
wp_delete_user( self::$user_id );
}
self::delete_user( self::$user_id );
}

public function set_up() {
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/tests/Entities/User_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
}

public static function wpTearDownAfterClass() {
if ( is_multisite() ) {
wpmu_delete_user( self::$user_id );
} else {
wp_delete_user( self::$user_id );
}
self::delete_user( self::$user_id );
}

public function set_up() {
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/tests/General/Current_User_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {

public static function wpTearDownAfterClass() {
foreach ( self::$user_ids as $user_id ) {
if ( is_multisite() ) {
wpmu_delete_user( $user_id );
} else {
wp_delete_user( $user_id );
}
self::delete_user( $user_id );
}
}

Expand Down

0 comments on commit 1700958

Please sign in to comment.