Skip to content

Commit 83baaa8

Browse files
committed
applied code review suggestion on tests and auth config file
1 parent 1b406e4 commit 83baaa8

3 files changed

Lines changed: 12 additions & 34 deletions

File tree

src/Config/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function registerRedirect(): string
383383
* Returns the URL the user should be redirected to
384384
* if force_reset identity is set to true.
385385
*/
386-
public function forcePasswordResetRedirect()
386+
public function forcePasswordResetRedirect(): string
387387
{
388388
$url = setting('Auth.redirects')['force_reset'];
389389

tests/Authentication/ForcePasswordResetTest.php

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ protected function setUp(): void
4444

4545
public function testUserRequiresPasswordReset(): void
4646
{
47-
/**
48-
* @phpstan-var User
49-
*/
47+
/** @var User $user */
5048
$user = fake(UserModel::class);
5149
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
5250

53-
/**
54-
* @phpstan-var UserIdentityModel
55-
*/
51+
/** @var UserIdentityModel $identity */
5652
$identity = model(UserIdentityModel::class);
5753
$identity->set('force_reset', 1);
5854
$identity->where('user_id', $user->id);
@@ -63,9 +59,7 @@ public function testUserRequiresPasswordReset(): void
6359

6460
public function testForcePasswordResetOnUser(): void
6561
{
66-
/**
67-
* @phpstan-var User
68-
*/
62+
/** @var User $user */
6963
$user = fake(UserModel::class);
7064
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
7165
$user->forcePasswordReset();
@@ -75,9 +69,7 @@ public function testForcePasswordResetOnUser(): void
7569

7670
public function testUndoForcePasswordResetOnUser(): void
7771
{
78-
/**
79-
* @phpstan-var User
80-
*/
72+
/** @var User $user */
8173
$user = fake(UserModel::class);
8274
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
8375
$user->forcePasswordReset();
@@ -88,9 +80,7 @@ public function testUndoForcePasswordResetOnUser(): void
8880

8981
public function testRequiresPasswordResetRedirect(): void
9082
{
91-
/**
92-
* @phpstan-var User
93-
*/
83+
/** @var User $user */
9484
$user = fake(UserModel::class);
9585
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
9686
$user->forcePasswordReset();
@@ -104,22 +94,16 @@ public function testRequiresPasswordResetRedirect(): void
10494

10595
public function testForceGlobalPasswordReset(): void
10696
{
107-
/**
108-
* @phpstan-var User
109-
*/
97+
/** @var User $user */
11098
$user = fake(UserModel::class);
11199
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
112100
$this->actingAs($user);
113101

114-
/**
115-
* @phpstan-var Fabricator
116-
*/
102+
/** @var Fabricator $fabricator */
117103
$fabricator = new Fabricator(UserIdentityModel::class);
118104
$fabricator->create(50);
119105

120-
/**
121-
* @phpstan-var UserIdentityModel
122-
*/
106+
/** @var UserIdentityModel $identities */
123107
$identities = model(UserIdentityModel::class);
124108
$identities->forceGlobalPasswordReset();
125109

tests/Unit/UserIdentityModelTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,11 @@ public function testCreateCodeIdentityThrowsExceptionIfUniqueCodeIsNotGot(): voi
7676

7777
public function testForceMultiplePasswordReset(): void
7878
{
79-
/**
80-
* @phpstan-var Fabricator
81-
*/
79+
/** @var Fabricator $fabricator */
8280
$fabricator = new Fabricator(UserIdentityModel::class);
8381
$fabricator->create(10);
8482

85-
/**
86-
* @phpstan-var UserIdentityModel
87-
*/
83+
/** @var UserIdentityModel $identities */
8884
$identities = model(UserIdentityModel::class);
8985
$result = $identities->select('user_id')->findAll();
9086
$userIds = [];
@@ -95,9 +91,7 @@ public function testForceMultiplePasswordReset(): void
9591

9692
$identities->forceMultiplePasswordReset($userIds);
9793

98-
/**
99-
* @phpstan-var UserModel
100-
*/
94+
/** @var UserModel $users */
10195
$users = model(UserModel::class);
10296
$first_user = $users->findById($userIds[0]);
10397
$last_user = $users->findById($userIds[9]);

0 commit comments

Comments
 (0)