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.

ResetPasswordFormTest.php 1.1KB

8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace tests\codeception\frontend\unit\models;
  3. use tests\codeception\frontend\unit\DbTestCase;
  4. use tests\codeception\common\fixtures\UserFixture;
  5. use frontend\models\ResetPasswordForm;
  6. class ResetPasswordFormTest extends DbTestCase
  7. {
  8. /**
  9. * @expectedException \yii\base\InvalidParamException
  10. */
  11. public function testResetWrongToken()
  12. {
  13. new ResetPasswordForm('notexistingtoken_1391882543');
  14. }
  15. /**
  16. * @expectedException \yii\base\InvalidParamException
  17. */
  18. public function testResetEmptyToken()
  19. {
  20. new ResetPasswordForm('');
  21. }
  22. public function testResetCorrectToken()
  23. {
  24. $form = new ResetPasswordForm($this->user[0]['password_reset_token']);
  25. expect('password should be resetted', $form->resetPassword())->true();
  26. }
  27. public function fixtures()
  28. {
  29. return [
  30. 'user' => [
  31. 'class' => UserFixture::className(),
  32. 'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php'
  33. ],
  34. ];
  35. }
  36. }