Make WordPress Core

Changeset 1250 in tests for trunk/tests/auth.php


Ignore:
Timestamp:
03/27/2013 02:09:52 PM (12 years ago)
Author:
westi
Message:

Pluggable Functions: Add some tests for passwords with trailing and leading spaces.

See #23494.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/auth.php

    r909 r1250  
    4242        $this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
    4343    }
     44
     45    /*
     46     * @ticket 23494
     47     */
     48    function test_password_trimming() {
     49        $another_user = $this->factory->user->create( array( 'user_login' => 'password-triming-tests' ) );
     50
     51        $passwords_to_test = array(
     52            'a password with no trailing or leading spaces',
     53            'a password with trailing spaces ',
     54            ' a password with leading spaces',
     55            ' a password with trailing and leading spaces ',
     56        );
     57
     58        foreach( $passwords_to_test as $password_to_test ) {
     59            wp_set_password( $password_to_test, $another_user );
     60            $authed_user = wp_authenticate( 'password-triming-tests', $password_to_test );
     61
     62            $this->assertInstanceOf( 'WP_User', $authed_user );
     63            $this->assertEquals( $another_user, $authed_user->ID );
     64        }
     65    }
    4466}
Note: See TracChangeset for help on using the changeset viewer.