mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Fix some tests.
This commit is contained in:
@@ -49,7 +49,7 @@ class LoginController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
@@ -71,10 +71,6 @@ class LoginController extends Controller
|
||||
public function login(Request $request)
|
||||
{
|
||||
$this->validateLogin($request);
|
||||
|
||||
// If the class is using the ThrottlesLogins trait, we can automatically throttle
|
||||
// the login attempts for this application. We'll key this by the username and
|
||||
// the IP address of the client making these requests into this application.
|
||||
$lockedOut = $this->hasTooManyLoginAttempts($request);
|
||||
if ($lockedOut) {
|
||||
$this->fireLockoutEvent($request);
|
||||
@@ -83,7 +79,7 @@ class LoginController extends Controller
|
||||
}
|
||||
|
||||
$credentials = $this->credentials($request);
|
||||
$credentials['blocked'] = 0; // most not be blocked.
|
||||
$credentials['blocked'] = 0; // must not be blocked.
|
||||
|
||||
if ($this->guard()->attempt($credentials, $request->has('remember'))) {
|
||||
return $this->sendLoginResponse($request);
|
||||
|
10
test.sh
10
test.sh
@@ -11,8 +11,9 @@ resetestflag=''
|
||||
testflag=''
|
||||
coverageflag=''
|
||||
acceptancetestclass=''
|
||||
verbalflag=''
|
||||
|
||||
while getopts 'crta:' flag; do
|
||||
while getopts 'vcrta:' flag; do
|
||||
case "${flag}" in
|
||||
r)
|
||||
resetestflag='true'
|
||||
@@ -23,6 +24,9 @@ while getopts 'crta:' flag; do
|
||||
c)
|
||||
coverageflag='true'
|
||||
;;
|
||||
v)
|
||||
verbalflag=' -v'
|
||||
;;
|
||||
a)
|
||||
acceptancetestclass=./tests/acceptance/$OPTARG
|
||||
echo "Will only run acceptance test $OPTARG"
|
||||
@@ -82,10 +86,10 @@ else
|
||||
if [[ $coverageflag == "" ]]
|
||||
then
|
||||
echo "Must run PHPUnit without coverage"
|
||||
phpunit $acceptancetestclass
|
||||
phpunit --stop-on-error $verbalflag $acceptancetestclass
|
||||
else
|
||||
echo "Must run PHPUnit with coverage"
|
||||
phpunit --configuration phpunit.coverage.xml $acceptancetestclass
|
||||
phpunit --stop-on-error $verbalflag --configuration phpunit.coverage.xml $acceptancetestclass
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -49,7 +49,7 @@ class ConfirmationControllerTest extends TestCase
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null);
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($trueConfig);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->andReturn($trueConfig);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('confirmation_error'));
|
||||
$this->assertResponseStatus(200);
|
||||
@@ -100,11 +100,11 @@ class ConfirmationControllerTest extends TestCase
|
||||
Preferences::shouldReceive('get')->withArgs(['user_confirmed_last_mail', 0])->andReturn($timePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($trueConfig);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->andReturn($trueConfig);
|
||||
Preferences::shouldReceive('get')->withArgs(['user_confirmed', false])->andReturn($falsePreference);
|
||||
|
||||
// from event handler:
|
||||
Preferences::shouldReceive('setForUser')->withAnyArgs()->once();
|
||||
Preferences::shouldReceive('setForUser')->withAnyArgs();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('resend_confirmation'));
|
||||
|
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ForgotPasswordControllerTest.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Auth;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
|
||||
*/
|
||||
class ForgotPasswordControllerTest extends TestCase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::broker
|
||||
* Implement testBroker().
|
||||
*/
|
||||
public function testBroker()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::sendResetLinkEmail
|
||||
* Implement testSendResetLinkEmail().
|
||||
*/
|
||||
public function testSendResetLinkEmail()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::showLinkRequestForm
|
||||
* Implement testShowLinkRequestForm().
|
||||
*/
|
||||
public function testShowLinkRequestForm()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
}
|
@@ -35,10 +35,12 @@ class LoginControllerTest extends TestCase
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->visit('/login')
|
||||
->type('thegrumpydictator@gmail.com', 'email')
|
||||
->type('james', 'password')
|
||||
->press('Sign In')
|
||||
->seePageIs('/')
|
||||
->see('thegrumpydictator@gmail.com');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,22 +49,9 @@ class LoginControllerTest extends TestCase
|
||||
*/
|
||||
public function testLogout()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\LoginController::redirectPath
|
||||
* Implement testRedirectPath().
|
||||
*/
|
||||
public function testRedirectPath()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->visit('/logout')
|
||||
->seePageIs('/login')
|
||||
->see('Sign in to start your session');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,22 +60,9 @@ class LoginControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowLoginForm()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\LoginController::username
|
||||
* Implement testUsername().
|
||||
*/
|
||||
public function testUsername()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->visit('/')
|
||||
->seePageIs('/login')
|
||||
->see('Sign in to start your session');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -11,10 +11,6 @@
|
||||
*/
|
||||
class HomeControllerTest extends TestCase
|
||||
{
|
||||
public function displayError()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
@@ -80,7 +76,7 @@ class HomeControllerTest extends TestCase
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('allRoutes'));
|
||||
$this->call('GET', route('all-routes'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
@@ -90,7 +86,7 @@ class HomeControllerTest extends TestCase
|
||||
public function testTestFlash()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('testFlash'));
|
||||
$this->call('GET', route('test-flash'));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertSessionHas('info');
|
||||
|
Reference in New Issue
Block a user