Make WordPress Core

Ticket #11959: 11959.test.patch

File 11959.test.patch, 685 bytes (added by johnpbloch, 12 years ago)

username_exists() test

  • tests/tests/user.php

     
    636636                // If this test fails, it will error out for calling the to_array() method on a non-object.
    637637                $this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) );
    638638        }
     639
     640        function test_username_exists() {
     641                $user_login = 'foo' . rand( 1, 100 );
     642                $user_id    = $this->factory->user->create( compact( 'user_login' ) );
     643
     644                $this->assertEquals( $user_id, username_exists( $user_login ) );
     645                $this->assertNull( username_exists( 'this_should_not_exist' ) );
     646        }
     647
    639648}