Make WordPress Core

Ticket #32158: 32158.test.3.diff

File 32158.test.3.diff, 1.3 KB (added by tyxla, 8 years ago)

Updating the unit tests by @collinsinternet to make them apply cleanly and fix a couple of minor things.

  • tests/phpunit/tests/user.php

     
    756756
    757757                $this->assertTrue( in_array( $id, $users ) );
    758758        }
     759
     760        /**
     761         * @ticket 32158
     762         */
     763        function test_email_case() {
     764                // Create a test user with a lower-case email address.
     765                $user_id = $this->factory->user->create( array(
     766                        'user_email'    => 'test@test.com',
     767                ) );
     768
     769                // Alter the case of the email address (which stays the same).
     770                $userdata = array(
     771                        'ID'                    => $user_id,
     772                        'user_email'    => 'test@TEST.com',
     773                );
     774                $update = wp_update_user( $userdata );
     775
     776                $this->assertEquals( $user_id, $update );
     777        }
     778
     779        /**
     780         * @ticket 32158
     781         */
     782        function test_email_change() {
     783                // Create a test user.
     784                $user_id = $this->factory->user->create( array(
     785                        'user_email'    => 'test@test.com',
     786                ) );
     787
     788                // Change the email address.
     789                $userdata = array(
     790                        'ID'                    => $user_id,
     791                        'user_email'    => 'test2@test.com',
     792                );
     793                $update = wp_update_user( $userdata );
     794
     795                // Was this successful?
     796                $this->assertEquals( $user_id, $update );
     797
     798                // Verify that the email address has been updated.
     799                $user = get_userdata( $user_id );
     800                $this->assertEquals( $user->user_email, 'test2@test.com' );
     801        }
     802
    759803}