mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed test coverage for user controller.
This commit is contained in:
parent
abbbba219a
commit
f5d3c770b4
@ -36,7 +36,7 @@ class UserController extends BaseController
|
||||
public 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 BaseController
|
||||
public 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 BaseController
|
||||
public function postRemindme()
|
||||
{
|
||||
$user = $this->user->findByEmail(Input::get('email'));
|
||||
if ($user) {
|
||||
if (!$user) {
|
||||
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');
|
||||
}
|
||||
if (Config::get('auth.verify_reset') === false) {
|
||||
$this->email->sendPasswordMail($user);
|
||||
return View::make('user.registered');
|
||||
}
|
||||
}
|
||||
Session::flash('error', 'No good!');
|
||||
return View::make('user.remindme');
|
||||
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user