Skip to content

Commit

Permalink
Use regex to generate passwords with faker
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpar06 committed Jul 26, 2024
1 parent a2728db commit 51aef03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function getUserData(): array
$home = Airport::factory()->create(['hub' => true]);

$faker = \Faker\Factory::create();
$password = $faker->password(8);
$password = $faker->regexify('[A-Z]{3}[a-z]{3}[0-9]{2}');

return [
'name' => 'Test User',
Expand Down
6 changes: 3 additions & 3 deletions tests/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function testUserPilotIdInvalidIATA(): void
public function testUserPilotIdAdded()
{
$faker = \Faker\Factory::create();
$password = Hash::make($faker->password(8));
$password = Hash::make($faker->regexify('[A-Z]{3}[a-z]{3}[0-9]{2}'));

$new_user = User::factory()->make()->makeVisible(['api_key', 'name', 'email'])->toArray();
$new_user['password'] = $password;
Expand All @@ -319,7 +319,7 @@ public function testUserPilotIdAdded()
public function testUserPilotDeleted()
{
$faker = \Faker\Factory::create();
$password = Hash::make($faker->password(8));
$password = Hash::make($faker->regexify('[A-Z]{3}[a-z]{3}[0-9]{2}'));

$new_user = User::factory()->make()->makeVisible(['api_key', 'name', 'email'])->toArray();
$new_user['password'] = $password;
Expand All @@ -344,7 +344,7 @@ public function testUserPilotDeleted()
public function testUserPilotDeletedWithPireps()
{
$faker = \Faker\Factory::create();
$password = Hash::make($faker->password(8));
$password = Hash::make($faker->regexify('[A-Z]{3}[a-z]{3}[0-9]{2}'));

$new_user = User::factory()->make()->makeVisible(['api_key', 'name', 'email'])->toArray();
$new_user['password'] = $password;
Expand Down

0 comments on commit 51aef03

Please sign in to comment.