示例#1
0
 public function testUpdateCorrect()
 {
     /** @var User $user */
     $user = User::findOne($this->users[0]['id']);
     $form = new ProfileUpdateForm($user);
     $form->setAttributes(['email' => '*****@*****.**']);
     expect('user is updated', $form->update())->true();
     expect('email is new', $user->email)->equals('*****@*****.**');
 }
示例#2
0
 public function actionUpdate()
 {
     $user = $this->findModel();
     $model = new ProfileUpdateForm($user);
     if ($model->load(Yii::$app->request->post()) && $model->update()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }