Исправлен баг с ссылками в email с активацией

This commit is contained in:
ErickSkrauch
2017-06-11 21:06:55 +03:00
parent 861c6810cb
commit 013d0eda60
4 changed files with 22 additions and 7 deletions

View File

@ -97,16 +97,25 @@ class RegistrationFormTest extends TestCase {
'username' => 'some_username',
'email' => 'some_email@example.com',
])->exists(), 'user model exists in database');
$this->assertTrue(EmailActivation::find()->andWhere([
'account_id' => $account->id,
'type' => EmailActivation::TYPE_REGISTRATION_EMAIL_CONFIRMATION,
])->exists(), 'email activation code exists in database');
/** @var EmailActivation $activation */
$activation = EmailActivation::find()
->andWhere([
'account_id' => $account->id,
'type' => EmailActivation::TYPE_REGISTRATION_EMAIL_CONFIRMATION,
])
->one();
$this->assertInstanceOf(EmailActivation::class, $activation, 'email activation code exists in database');
$this->assertTrue(UsernameHistory::find()->andWhere([
'username' => $account->username,
'account_id' => $account->id,
'applied_in' => $account->created_at,
])->exists(), 'username history record exists in database');
$this->tester->canSeeEmailIsSent(1);
/** @var \yii\swiftmailer\Message $email */
$email = $this->tester->grabSentEmails()[0];
$body = $email->getSwiftMessage()->getBody();
$this->assertContains($activation->key, $body);
$this->assertContains('/activation/' . $activation->key, $body);
}
private function mockRequest($ip = '88.225.20.236') {