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