/** * Signs user up, using regular workflow. * @return mixed response */ public function actionIndex() { $model = new SignupForm(); if ($model->load(Yii::$app->request->post())) { if (($user = $model->signup()) !== null) { if (Yii::$app->getUser()->login($user)) { return $this->goHome(); } } } return $this->render('index', ['model' => $model]); }
public function testNotCorrectSignup() { $model = new SignupForm(['email' => '*****@*****.**', 'password' => 'some_password', 'verifyCode' => 'testme']); expect('username and email are in use, user should not be created', $model->signup())->null(); }