Make WordPress Core


Ignore:
Timestamp:
08/22/2019 01:52:16 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Users: Adjust [45708] to make sure wp_update_user() does not issue a WP_Error if a single site was previously set up as Multisite and there's still a spam field in the user table.

Add a unit test.

Props azaozz, SergeyBiryukov.
Fixes #45747.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r45859 r45874  
    576576
    577577        /**
     578         * @ticket 45747
     579         */
     580        function test_wp_update_user_should_not_mark_user_as_spam_on_single_site() {
     581                if ( is_multisite() ) {
     582                        $this->markTestSkipped( 'This test is intended for single site.' );
     583                }
     584
     585                $u = wp_update_user(
     586                        array(
     587                                'ID'   => self::$contrib_id,
     588                                'spam' => '0',
     589                        )
     590                );
     591
     592                $this->assertNotWPError( $u );
     593
     594                $u = wp_update_user(
     595                        array(
     596                                'ID'   => self::$contrib_id,
     597                                'spam' => '1',
     598                        )
     599                );
     600
     601                $this->assertWPError( $u );
     602                $this->assertSame( 'no_spam', $u->get_error_code() );
     603        }
     604
     605        /**
    578606         * @ticket 28315
    579607         */
Note: See TracChangeset for help on using the changeset viewer.