|
|
|
@ -28,14 +28,14 @@ class PasswordResetRequestFormTest extends DbTestCase
|
|
|
|
|
|
|
|
|
|
public function testSendEmailWrongUser() |
|
|
|
|
{ |
|
|
|
|
$this->specify('no user with such email, message should not be send', function() { |
|
|
|
|
$this->specify('no user with such email, message should not be send', function () { |
|
|
|
|
$model = new PasswordResetRequestForm(); |
|
|
|
|
$model->email = 'not-existing-email@example.com'; |
|
|
|
|
|
|
|
|
|
expect('email not send', $model->sendEmail())->false(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$this->specify('user is not active, message should not be send', function() { |
|
|
|
|
$this->specify('user is not active, message should not be send', function () { |
|
|
|
|
$model = new PasswordResetRequestForm(); |
|
|
|
|
$model->email = $this->user[1]['email']; |
|
|
|
|
|
|
|
|
@ -52,8 +52,8 @@ class PasswordResetRequestFormTest extends DbTestCase
|
|
|
|
|
expect('email sent', $model->sendEmail())->true(); |
|
|
|
|
expect('user has valid token', $user->password_reset_token)->notNull(); |
|
|
|
|
|
|
|
|
|
$this->specify('message has correct format', function() use ($model) { |
|
|
|
|
expect('message file exists', file_exists($this->getMessageFile()))->true(); |
|
|
|
|
$this->specify('message has correct format', function () use ($model) { |
|
|
|
|
expect('message file exists', file_exists($this->getMessageFile()))->true(); |
|
|
|
|
|
|
|
|
|
$message = file_get_contents($this->getMessageFile()); |
|
|
|
|
expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']); |
|
|
|
@ -75,5 +75,4 @@ class PasswordResetRequestFormTest extends DbTestCase
|
|
|
|
|
{ |
|
|
|
|
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|