I am learning how to implement testing and try/catch statements into my code. I have a Laravel application with the following method. I am looking for advice on where I should add in try/catch statements and what phpunit unit-test(s) I would create to ensure this is functioning properly. Tips on comment blocks are also appreciated.// User sign uppublic function postSignup() {    $validator = Validator::make(Input::all(), User::$rules);    $confirmation_code = MyHelper::encrypt_decrypt('encrypt',Input::get('email'));    if($validator->passes()) {        $user = new User;        $user->email = Input::get('email');        $user->password = Hash::make(Input::get('password'));        $user->emailVerifiedToken = $confirmation_code;        $user->firstName = null;        $user->lastName = null;        $user->shipAddressId = null;        $user->billAddressId = null;        $user->phone = null;        $user->save();        $userdata = array(            'token' => $confirmation_code        );        //Send the user an email requesting verification        $toEmail = $user->email;        $toName = $user->email;        $subject = Email Verification - example.com;        Mail::queue('emails.account.account-creation', $userdata, function($message) use ($toEmail,$toName,$subject)        {            $message->to($toEmail,$toName)->subject($subject);        });        if(Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), false))        {            return Redirect::to('/home/')            ->with('login_message', 'Thank you for creating a new account, please sign in');        }    }    return Redirect::to('/account/sign-up')            ->with('signup_message',  'Something went wrong')            ->withErrors($validator)            ->withInput();}
Basic sign-up method, testable and with try/catch
php;unit testing;authentication;laravel;integration testing