Passed
Push — master ( a10e59...b3c3af )
by Torben
01:55
created

FrontendUserServiceTest::setup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Derhansen\FeChangePwd\Tests\Unit\Service;
3
4
/*
5
 * This file is part of the Extension "fe_change_pwd" for TYPO3 CMS.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.txt file that was distributed with this source code.
9
 */
10
11
use Derhansen\FeChangePwd\Service\FrontendUserService;
12
use Nimut\TestingFramework\TestCase\UnitTestCase;
13
14
/**
15
 * Class FrontendUserServiceTest
16
 */
17
class FrontendUserServiceTest extends UnitTestCase
18
{
19
    /**
20
     * @var FrontendUserService
21
     */
22
    protected $subject;
23
24
    /**
25
     * Setup
26
     *
27
     * @return void
28
     */
29
    public function setup()
30
    {
31
        parent::setUp();
32
        $this->subject = new FrontendUserService();
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function mustChangePasswordReturnsExpectedResultDataProvider()
39
    {
40
        return [
41
            'no frontend user' => [
42
                [],
43
                false
44
            ],
45
            'must change password' => [
46
                [
47
                    'must_change_password' => 1,
48
                    'password_expiry_date' => 0
49
                ],
50
                true
51
            ],
52
            'password expired' => [
53
                [
54
                    'must_change_password' => 0,
55
                    'password_expiry_date' => 1538194307
56
                ],
57
                true
58
            ],
59
            'password not expired and no password change required' => [
60
                [
61
                    'must_change_password' => 0,
62
                    'password_expiry_date' => 0
63
                ],
64
                false
65
            ],
66
        ];
67
    }
68
69
    /**
70
     * @test
71
     * @dataProvider mustChangePasswordReturnsExpectedResultDataProvider
72
     */
73
    public function mustChangePasswordReturnsExpectedResult($feUserRecord, $expected)
74
    {
75
        $this->assertEquals($expected, $this->subject->mustChangePassword($feUserRecord));
76
    }
77
}
78