Skip to content

Commit 9d92c26

Browse files
committed
Add generateUsername function to AuthenticationTest.php
1 parent d93f032 commit 9d92c26

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/Feature/AuthenticationTest.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,17 @@ public function testCanSeeNewPasswordForm()
141141
$response->assertStatus( 200 );
142142
}
143143

144+
public function generateUsername($faker, $minLength = 10) {
145+
$username = $faker->userName;
146+
while(strlen($username) < $minLength) {
147+
$username .= $faker->randomLetter;
148+
}
149+
return $username;
150+
}
151+
144152
public function testSubmitRegistrationForm()
145153
{
146-
$password = $this->faker->password();
154+
$password = $this->faker->password(8);
147155
$registration_validated = ns()->option->get( 'ns_registration_validated', 'yes' );
148156

149157
/**
@@ -152,7 +160,7 @@ public function testSubmitRegistrationForm()
152160
*/
153161
ns()->option->set( 'ns_registration_enabled', 'yes' );
154162

155-
$username = $this->faker->userName();
163+
$username = $this->generateUsername(6);
156164
$email = $this->faker->email();
157165

158166
$response = $this

0 commit comments

Comments
 (0)