-
Notifications
You must be signed in to change notification settings - Fork 308
/
Copy pathEmailVerificationPromptControllerTest.php
55 lines (41 loc) · 1.75 KB
/
EmailVerificationPromptControllerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace Laravel\Fortify\Tests;
use Illuminate\Contracts\Auth\Authenticatable;
use Laravel\Fortify\Contracts\VerifyEmailViewResponse;
use Mockery;
class EmailVerificationPromptControllerTest extends OrchestraTestCase
{
public function test_the_email_verification_prompt_view_is_returned()
{
$this->mock(VerifyEmailViewResponse::class)
->shouldReceive('toResponse')
->andReturn(response('hello world'));
$user = Mockery::mock(Authenticatable::class);
$user->shouldReceive('hasVerifiedEmail')->andReturn(false);
$response = $this->actingAs($user)->get('/email/verify');
$response->assertStatus(200);
$response->assertSeeText('hello world');
}
public function test_user_is_redirect_home_if_already_verified()
{
$this->mock(VerifyEmailViewResponse::class)
->shouldReceive('toResponse')
->andReturn(response('hello world'));
$user = Mockery::mock(Authenticatable::class);
$user->shouldReceive('hasVerifiedEmail')->andReturn(true);
$response = $this->actingAs($user)->get('/email/verify');
$response->assertRedirect('/home');
}
public function test_user_is_redirect_to_intended_url_if_already_verified()
{
$this->mock(VerifyEmailViewResponse::class)
->shouldReceive('toResponse')
->andReturn(response('hello world'));
$user = Mockery::mock(Authenticatable::class);
$user->shouldReceive('hasVerifiedEmail')->andReturn(true);
$response = $this->actingAs($user)
->withSession(['url.intended' => 'http://foo.com/bar'])
->get('/email/verify');
$response->assertRedirect('http://foo.com/bar');
}
}