Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in tests.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45588 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-07-02 04:43:01 +00:00
parent 969c17d82d
commit fe28df65e3
36 changed files with 278 additions and 132 deletions

View File

@@ -18,7 +18,7 @@ class Tests_User extends WP_UnitTestCase {
protected $user_data;
public static function wpSetUpBeforeClass( $factory ) {
self::$user_ids[] = self::$contrib_id = $factory->user->create(
self::$contrib_id = $factory->user->create(
array(
'user_login' => 'user1',
'user_nicename' => 'userone',
@@ -33,23 +33,28 @@ class Tests_User extends WP_UnitTestCase {
'description' => 'I am a WordPress user that cares about privacy.',
)
);
self::$user_ids[] = self::$contrib_id;
self::$user_ids[] = self::$author_id = $factory->user->create(
self::$author_id = $factory->user->create(
array(
'user_login' => 'author_login',
'user_email' => 'author@email.com',
'role' => 'author',
)
);
self::$user_ids[] = self::$author_id;
self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
self::$user_ids[] = self::$editor_id = $factory->user->create(
self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
self::$user_ids[] = self::$admin_id;
self::$editor_id = $factory->user->create(
array(
'role' => 'editor',
'user_email' => 'test@test.com',
)
);
self::$user_ids[] = self::$sub_id = $factory->user->create( array( 'role' => 'subscriber' ) );
self::$user_ids[] = self::$editor_id;
self::$sub_id = $factory->user->create( array( 'role' => 'subscriber' ) );
self::$user_ids[] = self::$sub_id;
self::$_author = get_user_by( 'ID', self::$author_id );
}
@@ -1374,7 +1379,9 @@ class Tests_User extends WP_UnitTestCase {
* @ticket 35715
*/
function test_edit_user_blank_pw() {
$_POST = $_GET = $_REQUEST = array();
$_POST = array();
$_GET = array();
$_REQUEST = array();
$_POST['role'] = 'subscriber';
$_POST['email'] = 'user1@example.com';
$_POST['user_login'] = 'user_login1';
@@ -1390,7 +1397,8 @@ class Tests_User extends WP_UnitTestCase {
$this->assertEquals( 'pass', $response->get_error_code() );
// Check new user with password set.
$_POST['pass1'] = $_POST['pass2'] = 'password';
$_POST['pass1'] = 'password';
$_POST['pass2'] = 'password';
$user_id = edit_user();
$user = get_user_by( 'ID', $user_id );
@@ -1401,7 +1409,8 @@ class Tests_User extends WP_UnitTestCase {
// Check updating user with empty password.
$_POST['nickname'] = 'nickname_updated';
$_POST['pass1'] = $_POST['pass2'] = '';
$_POST['pass1'] = '';
$_POST['pass2'] = '';
$user_id = edit_user( $user_id );
@@ -1550,7 +1559,9 @@ class Tests_User extends WP_UnitTestCase {
* @ticket 42564
*/
function test_edit_user_role_update() {
$_POST = $_GET = $_REQUEST = array();
$_POST = array();
$_GET = array();
$_REQUEST = array();
$administrator = self::factory()->user->create(
array(