/** * @param array $signupData */ public function submit(array $signupData) { $signupForm = new SignupForm(); foreach ($signupData as $field => $value) { $inputType = $field === 'body' ? 'textarea' : 'input'; $this->actor->fillField($inputType . '[name="' . $signupForm->formName() . '[' . $field . ']"]', $value); } $this->actor->click('signup-button'); }
/** * 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(); }