xref: /webtrees/tests/app/Http/RequestHandlers/PasswordRequestPageTest.php (revision d403609d9adfb78373074e21cba0e7fd0ec71fde)
1*d403609dSGreg Roach<?php
2*d403609dSGreg Roach
3*d403609dSGreg Roach/**
4*d403609dSGreg Roach * webtrees: online genealogy
5*d403609dSGreg Roach * Copyright (C) 2019 webtrees development team
6*d403609dSGreg Roach * This program is free software: you can redistribute it and/or modify
7*d403609dSGreg Roach * it under the terms of the GNU General Public License as published by
8*d403609dSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*d403609dSGreg Roach * (at your option) any later version.
10*d403609dSGreg Roach * This program is distributed in the hope that it will be useful,
11*d403609dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*d403609dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*d403609dSGreg Roach * GNU General Public License for more details.
14*d403609dSGreg Roach * You should have received a copy of the GNU General Public License
15*d403609dSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*d403609dSGreg Roach */
17*d403609dSGreg Roachdeclare(strict_types=1);
18*d403609dSGreg Roach
19*d403609dSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
20*d403609dSGreg Roach
21*d403609dSGreg Roachuse Fisharebest\Webtrees\TestCase;
22*d403609dSGreg Roachuse Fisharebest\Webtrees\User;
23*d403609dSGreg Roach
24*d403609dSGreg Roach/**
25*d403609dSGreg Roach * @covers \Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestPage
26*d403609dSGreg Roach */
27*d403609dSGreg Roachclass PasswordRequestPageTest extends TestCase
28*d403609dSGreg Roach{
29*d403609dSGreg Roach    /**
30*d403609dSGreg Roach     * @return void
31*d403609dSGreg Roach     */
32*d403609dSGreg Roach    public function testPasswordRequestPage(): void
33*d403609dSGreg Roach    {
34*d403609dSGreg Roach        $request  = self::createRequest();
35*d403609dSGreg Roach        $handler  = new PasswordRequestPage();
36*d403609dSGreg Roach        $response = $handler->handle($request);
37*d403609dSGreg Roach
38*d403609dSGreg Roach        self::assertSame(self::STATUS_OK, $response->getStatusCode());
39*d403609dSGreg Roach    }
40*d403609dSGreg Roach
41*d403609dSGreg Roach    /**
42*d403609dSGreg Roach     * @return void
43*d403609dSGreg Roach     */
44*d403609dSGreg Roach    public function testPasswordRequestPageAlreadyLoggedIn(): void
45*d403609dSGreg Roach    {
46*d403609dSGreg Roach        $user     = $this->createMock(User::class);
47*d403609dSGreg Roach        $request  = self::createRequest()->withAttribute('user', $user);
48*d403609dSGreg Roach        $handler  = new PasswordRequestPage();
49*d403609dSGreg Roach        $response = $handler->handle($request);
50*d403609dSGreg Roach
51*d403609dSGreg Roach        self::assertSame(self::STATUS_FOUND, $response->getStatusCode());
52*d403609dSGreg Roach    }
53*d403609dSGreg Roach}
54