mirror of
https://github.com/elyby/accounts.git
synced 2024-12-04 20:49:48 +05:30
c0aa78d156
Completely removed usage of the RabbitMQ. Queue now based on Redis channels. Worker process now extracted as separate docker container. Base image upgraded to the 1.8.0 version (PHP 7.2.7 and pcntl extension).
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
namespace tests\codeception\api\models\authentication;
|
|
|
|
use api\components\User\AuthenticationResult;
|
|
use api\models\authentication\ConfirmEmailForm;
|
|
use common\models\Account;
|
|
use common\models\AccountSession;
|
|
use common\models\EmailActivation;
|
|
use tests\codeception\api\unit\TestCase;
|
|
use tests\codeception\common\fixtures\EmailActivationFixture;
|
|
|
|
class ConfirmEmailFormTest extends TestCase {
|
|
|
|
public function _fixtures() {
|
|
return [
|
|
'emailActivations' => EmailActivationFixture::class,
|
|
];
|
|
}
|
|
|
|
public function testConfirm() {
|
|
$fixture = $this->tester->grabFixture('emailActivations', 'freshRegistrationConfirmation');
|
|
$model = $this->createModel($fixture['key']);
|
|
$result = $model->confirm();
|
|
$this->assertInstanceOf(AuthenticationResult::class, $result);
|
|
$this->assertInstanceOf(AccountSession::class, $result->getSession(), 'session was generated');
|
|
$activationExists = EmailActivation::find()->andWhere(['key' => $fixture['key']])->exists();
|
|
$this->assertFalse($activationExists, 'email activation key is not exist');
|
|
/** @var Account $account */
|
|
$account = Account::findOne($fixture['account_id']);
|
|
$this->assertEquals(Account::STATUS_ACTIVE, $account->status, 'user status changed to active');
|
|
}
|
|
|
|
private function createModel($key) {
|
|
return new ConfirmEmailForm([
|
|
'key' => $key,
|
|
]);
|
|
}
|
|
|
|
}
|