ResetPasswordFormTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 36
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testResetWrongToken() 0 4 1
A testResetEmptyToken() 0 4 1
A testResetCorrectToken() 0 5 1
A fixtures() 0 9 1
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