From 7677eb2f8ed35a36ab63e6923bd983d8109fe8b6 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 1 Aug 2014 18:27:16 +0000 Subject: [PATCH] Account for `WP_IMPORTING` being defined in the unit tests added in [29339] when all tests are run. Glory, glory hallelujah. Fixes #28315. git-svn-id: https://develop.svn.wordpress.org/trunk@29341 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/user.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index f9484ed388..26e45a2ee2 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -632,11 +632,24 @@ class Tests_User extends WP_UnitTestCase { * @ticket 28315 */ function test_user_meta_error() { - $this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) ); - $id = $this->factory->user->create( array( 'user_email' => 'taco@burrito.com' ) ); + $id1 = wp_insert_user( array( + 'user_login' => rand_str(), + 'user_pass' => 'password', + 'user_email' => 'taco@burrito.com', + ) ); + $this->assertEquals( $id1, email_exists( 'taco@burrito.com' ) ); - $this->assertWPError( $id ); - @update_user_meta( $id, 'key', 'value' ); + $id2 = wp_insert_user( array( + 'user_login' => rand_str(), + 'user_pass' => 'password', + 'user_email' => 'taco@burrito.com', + ) ); + + if ( ! defined( 'WP_IMPORTING' ) ) { + $this->assertWPError( $id2 ); + } + + @update_user_meta( $id2, 'key', 'value' ); $metas = array_keys( get_user_meta( 1 ) ); $this->assertNotContains( 'key', $metas );