ResetPasswordFormTest::testResetWrongToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace tests\codeception\frontend\unit\models;
4
5
use tests\codeception\frontend\unit\DbTestCase;
6
use tests\codeception\common\fixtures\UserFixture;
7
use frontend\models\ResetPasswordForm;
8
9
class ResetPasswordFormTest extends DbTestCase
10
{
11
12
    /**
13
     * @expectedException \yii\base\InvalidParamException
14
     */
15
    public function testResetWrongToken()
16
    {
17
        new ResetPasswordForm('notexistingtoken_1391882543');
18
    }
19
20
    /**
21
     * @expectedException \yii\base\InvalidParamException
22
     */
23
    public function testResetEmptyToken()
24
    {
25
        new ResetPasswordForm('');
26
    }
27
28
    public function testResetCorrectToken()
29
    {
30
        $form = new ResetPasswordForm($this->user[0]['password_reset_token']);
31
        expect('password should be resetted', $form->resetPassword())->true();
32
    }
33
34
    public function fixtures()
35
    {
36
        return [
37
            'user' => [
38
                'class' => UserFixture::className(),
39
                'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php'
40
            ],
41
        ];
42
    }
43
44
}
45