Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fixed test coverage for user controller.
James Colef5d3c770b41b
diff --git a/app/controllers/UserController.php b/app/controllers/UserController.phpindex d46ef4e671..ab0570fa82 100644--- a/app/controllers/UserController.php+++ b/app/controllers/UserController.php@@ -36,7 +36,7 @@ class UserController extends BaseControllerpublic function register(){if (Config::get('auth.allow_register') !== true) {- App::abort(404);+ return View::make('error')->with('message', 'Not possible');}return View::make('user.register');}@@ -44,7 +44,7 @@ class UserController extends BaseControllerpublic function postRegister(){if (Config::get('auth.allow_register') !== true) {- App::abort(404);+ return View::make('error')->with('message', 'Not possible');}$user = $this->user->register(Input::all());if ($user) {@@ -72,18 +72,16 @@ class UserController extends BaseControllerpublic function postRemindme(){$user = $this->user->findByEmail(Input::get('email'));- if ($user) {- if (Config::get('auth.verify_reset') === true) {- $this->email->sendResetVerification($user);- return View::make('user.verification-pending');- }- if (Config::get('auth.verify_reset') === false) {- $this->email->sendPasswordMail($user);- return View::make('user.registered');- }+ if (!$user) {+ Session::flash('error', 'No good!');+ return View::make('user.remindme');}- Session::flash('error', 'No good!');- return View::make('user.remindme');+ if (Config::get('auth.verify_reset') === true) {+ $this->email->sendResetVerification($user);+ return View::make('user.verification-pending');+ }+ $this->email->sendPasswordMail($user);+ return View::make('user.registered');}diff --git a/app/tests/controllers/UserControllerTest.php b/app/tests/controllers/UserControllerTest.phpindex a709e8709b..5d80be2ed7 100644--- a/app/tests/controllers/UserControllerTest.php+++ b/app/tests/controllers/UserControllerTest.php@@ -57,16 +57,14 @@ class UserControllerTest extends TestCase$this->assertResponseOk();}- /**- * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException- */public function testRegisterNotAllowed(){// no mock for config! :(Config::set('auth.allow_register', false);// test$this->call('GET', '/register');- $this->assertResponseStatus(404);+ $this->assertResponseStatus(200);+ $this->assertViewHas('message','Not possible');}/**@@ -191,12 +189,9 @@ class UserControllerTest extends TestCase$this->call('POST', '/remindme');$this->assertResponseOk();- $this->assertSessionHas('error');+ $this->assertSessionHas('error','No good!');}- /**- * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException- */public function testPostRegisterNotAllowed(){// no mock for config! :(@@ -211,7 +206,8 @@ class UserControllerTest extends TestCase// test$this->call('POST', '/register', $data);- $this->assertResponseStatus(404);+ $this->assertResponseStatus(200);+ $this->assertViewHas('message','Not possible');}