Changes from branches/4.0/tests/phpunit/tests/auth.php at r30467 to trunk/tests/phpunit/tests/auth.php at r29620
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/auth.php
r30467 r29620 3 3 /** 4 4 * @group pluggable 5 * @group auth6 5 */ 7 6 class Tests_Auth extends WP_UnitTestCase { … … 101 100 $this->assertFalse( wp_verify_nonce( null ) ); 102 101 } 103 104 function test_password_length_limit() {105 $passwords = array(106 str_repeat( 'a', 4095 ), // short107 str_repeat( 'a', 4096 ), // limit108 str_repeat( 'a', 4097 ), // long109 );110 111 $user_id = $this->factory->user->create( array( 'user_login' => 'password-length-test' ) );112 113 wp_set_password( $passwords[1], $user_id );114 $user = get_user_by( 'id', $user_id );115 // phpass hashed password116 $this->assertStringStartsWith( '$P$', $user->data->user_pass );117 118 $user = wp_authenticate( 'password-length-test', $passwords[0] );119 // Wrong Password120 $this->assertInstanceOf( 'WP_Error', $user );121 122 $user = wp_authenticate( 'password-length-test', $passwords[1] );123 $this->assertInstanceOf( 'WP_User', $user );124 $this->assertEquals( $user_id, $user->ID );125 126 $user = wp_authenticate( 'password-length-test', $passwords[2] );127 // Wrong Password128 $this->assertInstanceOf( 'WP_Error', $user );129 130 131 wp_set_password( $passwords[2], $user_id );132 $user = get_user_by( 'id', $user_id );133 // Password broken by setting it to be too long.134 $this->assertEquals( '*', $user->data->user_pass );135 136 $user = wp_authenticate( 'password-length-test', $passwords[0] );137 // Wrong Password138 $this->assertInstanceOf( 'WP_Error', $user );139 140 $user = wp_authenticate( 'password-length-test', $passwords[1] );141 // Wrong Password142 $this->assertInstanceOf( 'WP_Error', $user );143 144 $user = wp_authenticate( 'password-length-test', $passwords[2] );145 // Password broken by setting it to be too long.146 $this->assertInstanceOf( 'WP_Error', $user );147 }148 102 }
Note: See TracChangeset
for help on using the changeset viewer.