ResetPasswordFormTest.php 984 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?php

namespace frontend\tests\unit\models;

use frontend\tests\unit\DbTestCase;
use common\tests\fixtures\UserFixture;
use frontend\models\ResetPasswordForm;

class ResetPasswordFormTest extends DbTestCase
{

12
    use \Codeception\Specify;
13

14 15 16 17 18 19
    public function testResetPassword()
    {
        $this->specify('wrong reset token', function () {
            $this->setExpectedException('\Exception', 'Wrong password reset token.');
            new ResetPasswordForm('notexistingtoken_1391882543');
        });
20

21 22 23 24 25
        $this->specify('not correct token', function () {
            $this->setExpectedException('yii\base\InvalidParamException', 'Password reset token cannot be blank.');
            new ResetPasswordForm('');
        });
    }
26

27 28 29 30 31
    public function fixtures()
    {
        return [
            'user' => [
                'class' => UserFixture::className(),
32
                'dataFile' => '@frontend/tests/unit/fixtures/data/user.php'
33 34 35
            ],
        ];
    }
36
}