/** * @test */ public function shouldRedirectToShowOnSuccessInUpdate() { //given $user = User::create(array('login' => 'login')); //when $this->put("/users/{$user->id}", array('user' => array('login' => 'new login'))); //then $this->assertRedirectsTo(userPath($user->id)); }
public function update() { $user = User::findById($this->params['id']); if ($user->updateAttributes($this->params['user'])) { $this->redirect(userPath($user->id), "User updated"); } else { $this->view->user = $user; $this->view->render('Users/edit'); } }