1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace frontend\tests\unit\models;
use frontend\tests\unit\DbTestCase;
use common\tests\fixtures\UserFixture;
use frontend\models\ResetPasswordForm;
class ResetPasswordFormTest extends DbTestCase
{
use \Codeception\Specify;
public function testResetPassword()
{
$this->specify('wrong reset token', function() {
$this->setExpectedException('\Exception','Wrong password reset token.');
new ResetPasswordForm('notexistingtoken_1391882543');
});
$this->specify('not correct token', function() {
$this->setExpectedException('yii\base\InvalidParamException','Password reset token cannot be blank.');
new ResetPasswordForm('');
});
}
public function fixtures()
{
return [
'user' => [
'class' => UserFixture::className(),
'dataFile' => '@frontend/tests/unit/fixtures/data/tbl_user.php'
],
];
}
}