Skip to content

Commit d20e4ae

Browse files
committed
Revert changes in MagicLinkTest and replace site_url(route_to()) by url_to()
1 parent 472a8ff commit d20e4ae

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/Views/email_2fa_show.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="alert alert-danger"><?= session('error') ?></div>
1616
<?php endif ?>
1717

18-
<form action="<?= site_url(route_to('auth-action-handle')) ?>" method="post">
18+
<form action="<?= url_to('auth-action-handle') ?>" method="post">
1919
<?= csrf_field() ?>
2020

2121
<!-- Email -->

src/Views/email_2fa_verify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="alert alert-danger"><?= session('error') ?></div>
1616
<?php endif ?>
1717

18-
<form action="<?= site_url(route_to('auth-action-verify')) ?>" method="post">
18+
<form action="<?= url_to('auth-action-verify') ?>" method="post">
1919
<?= csrf_field() ?>
2020

2121
<!-- Code -->

tests/Authentication/MagicLinkTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,29 @@ protected function setUp(): void
3737

3838
public function testCanSeeMagicLinkForm(): void
3939
{
40-
$result = $this->get(url_to('magic-link'));
40+
$result = $this->get(route_to('magic-link'));
4141

4242
$result->assertOK();
4343
$result->assertSee(lang('Auth.useMagicLink'));
4444
}
4545

4646
public function testMagicLinkSubmitNoEmail(): void
4747
{
48-
$result = $this->post(url_to('magic-link'), [
48+
$result = $this->post(route_to('magic-link'), [
4949
'email' => '',
5050
]);
5151

52-
$result->assertRedirectTo(url_to('magic-link'));
52+
$result->assertRedirectTo(route_to('magic-link'));
5353
$result->assertSessionHas('error', lang('Auth.invalidEmail'));
5454
}
5555

5656
public function testMagicLinkSubmitBadEmail(): void
5757
{
58-
$result = $this->post(url_to('magic-link'), [
58+
$result = $this->post(route_to('magic-link'), [
5959
'email' => 'foo@example.com',
6060
]);
6161

62-
$result->assertRedirectTo(url_to('magic-link'));
62+
$result->assertRedirectTo(route_to('magic-link'));
6363
$result->assertSessionHas('error', lang('Auth.invalidEmail'));
6464
}
6565

@@ -71,7 +71,7 @@ public function testMagicLinkSubmitSuccess(): void
7171
$user = fake(UserModel::class);
7272
$user->createEmailIdentity(['email' => 'foo@example.com', 'password' => 'secret123']);
7373

74-
$result = $this->post(url_to('magic-link'), [
74+
$result = $this->post(route_to('magic-link'), [
7575
'email' => 'foo@example.com',
7676
]);
7777

@@ -86,9 +86,9 @@ public function testMagicLinkSubmitSuccess(): void
8686

8787
public function testMagicLinkVerifyNoToken(): void
8888
{
89-
$result = $this->get(url_to('verify-magic-link'));
89+
$result = $this->get(route_to('verify-magic-link'));
9090

91-
$result->assertRedirectTo(url_to('magic-link'));
91+
$result->assertRedirectTo(route_to('magic-link'));
9292
$result->assertSessionHas('error', lang('Auth.magicTokenNotFound'));
9393
}
9494

@@ -107,9 +107,9 @@ public function testMagicLinkVerifyExpired(): void
107107
'expires' => Time::now()->subDays(5),
108108
]);
109109

110-
$result = $this->get(url_to('verify-magic-link') . '?token=' . 'abasdasdf');
110+
$result = $this->get(route_to('verify-magic-link') . '?token=' . 'abasdasdf');
111111

112-
$result->assertRedirectTo(url_to('magic-link'));
112+
$result->assertRedirectTo(route_to('magic-link'));
113113
$result->assertSessionHas('error', lang('Auth.magicLinkExpired'));
114114
}
115115

@@ -126,7 +126,7 @@ public function testMagicLinkVerifySuccess(): void
126126
'expires' => Time::now()->addMinutes(60),
127127
]);
128128

129-
$result = $this->get(url_to('verify-magic-link') . '?token=' . 'abasdasdf');
129+
$result = $this->get(route_to('verify-magic-link') . '?token=' . 'abasdasdf');
130130

131131
$result->assertRedirectTo(site_url());
132132
$result->assertSessionHas('user', ['id' => $user->id]);

0 commit comments

Comments
 (0)