You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
5 years ago
|
<?php
|
||
|
|
||
|
namespace tests\codeception\frontend\unit\models;
|
||
|
|
||
|
use tests\codeception\frontend\unit\DbTestCase;
|
||
|
use tests\codeception\common\fixtures\UserFixture;
|
||
|
use frontend\models\ResetPasswordForm;
|
||
|
|
||
|
class ResetPasswordFormTest extends DbTestCase
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* @expectedException \yii\base\InvalidParamException
|
||
|
*/
|
||
|
public function testResetWrongToken()
|
||
|
{
|
||
|
new ResetPasswordForm('notexistingtoken_1391882543');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @expectedException \yii\base\InvalidParamException
|
||
|
*/
|
||
|
public function testResetEmptyToken()
|
||
|
{
|
||
|
new ResetPasswordForm('');
|
||
|
}
|
||
|
|
||
|
public function testResetCorrectToken()
|
||
|
{
|
||
|
$form = new ResetPasswordForm($this->user[0]['password_reset_token']);
|
||
|
expect('password should be resetted', $form->resetPassword())->true();
|
||
|
}
|
||
|
|
||
|
public function fixtures()
|
||
|
{
|
||
|
return [
|
||
|
'user' => [
|
||
|
'class' => UserFixture::className(),
|
||
|
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php'
|
||
|
],
|
||
|
];
|
||
|
}
|
||
|
}
|