From 298f57841f12b9ac288dec593ea8998a98f682ea Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 28 Feb 2016 15:08:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/models/RegistrationForm.php | 2 ++ tests/codeception/api/unit/models/RegistrationFormTest.php | 1 + 2 files changed, 3 insertions(+) diff --git a/api/models/RegistrationForm.php b/api/models/RegistrationForm.php index 0926189..f476675 100644 --- a/api/models/RegistrationForm.php +++ b/api/models/RegistrationForm.php @@ -5,6 +5,7 @@ use api\components\ReCaptcha\Validator as ReCaptchaValidator; use common\components\UserFriendlyRandomKey; use common\models\Account; use common\models\EmailActivation; +use Ramsey\Uuid\Uuid; use Yii; use yii\base\ErrorException; @@ -62,6 +63,7 @@ class RegistrationForm extends BaseApiForm { $transaction = Yii::$app->db->beginTransaction(); try { $account = new Account(); + $account->uuid = Uuid::uuid4(); $account->email = $this->email; $account->username = $this->username; $account->password = $this->password; diff --git a/tests/codeception/api/unit/models/RegistrationFormTest.php b/tests/codeception/api/unit/models/RegistrationFormTest.php index f6ccdfc..8aac3bf 100644 --- a/tests/codeception/api/unit/models/RegistrationFormTest.php +++ b/tests/codeception/api/unit/models/RegistrationFormTest.php @@ -93,6 +93,7 @@ class RegistrationFormTest extends DbTestCase { expect('user should be valid', $user)->isInstanceOf(Account::class); expect('password should be correct', $user->validatePassword('some_password'))->true(); + expect('uuid is set', $user->uuid)->notEmpty(); expect('user model exists in database', Account::find()->andWhere([ 'username' => 'some_username', 'email' => 'some_email@example.com',