mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-13 13:18:30 +00:00
Expand test routines
This commit is contained in:
@@ -81,10 +81,10 @@ Route::group(
|
|||||||
Route::group(
|
Route::group(
|
||||||
['middleware' => ['user-full-auth']], function () {
|
['middleware' => ['user-full-auth']], function () {
|
||||||
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
|
||||||
Route::get('/flash', ['uses' => 'HomeController@testFlash', 'as' => 'testFlash']);
|
Route::get('/flash', ['uses' => 'HomeController@testFlash', 'as' => 'test-flash']);
|
||||||
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
||||||
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
||||||
Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'allRoutes']);
|
Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'all-routes']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ Route::group(
|
|||||||
* JSON Controller
|
* JSON Controller
|
||||||
*/
|
*/
|
||||||
Route::group(
|
Route::group(
|
||||||
['middleware' => 'user-full-auth', 'prefix' => 'json', 'as' => 'admin.'], function () {
|
['middleware' => 'user-full-auth', 'prefix' => 'json', 'as' => 'json.'], function () {
|
||||||
Route::get('expense-accounts', ['uses' => 'JsonController@expenseAccounts', 'as' => 'expense-accounts']);
|
Route::get('expense-accounts', ['uses' => 'JsonController@expenseAccounts', 'as' => 'expense-accounts']);
|
||||||
Route::get('revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'revenue-accounts']);
|
Route::get('revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'revenue-accounts']);
|
||||||
Route::get('categories', ['uses' => 'JsonController@categories', 'as' => 'categories']);
|
Route::get('categories', ['uses' => 'JsonController@categories', 'as' => 'categories']);
|
||||||
@@ -371,7 +371,7 @@ Route::group(
|
|||||||
Route::get('box/out', ['uses' => 'JsonController@boxOut', 'as' => 'box.out']);
|
Route::get('box/out', ['uses' => 'JsonController@boxOut', 'as' => 'box.out']);
|
||||||
Route::get('box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'box.paid']);
|
Route::get('box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'box.paid']);
|
||||||
Route::get('box/bills-paid', ['uses' => 'JsonController@boxBillsPaid', 'as' => 'box.unpaid']);
|
Route::get('box/bills-paid', ['uses' => 'JsonController@boxBillsPaid', 'as' => 'box.unpaid']);
|
||||||
Route::get('transaction-journals/{what}', 'JsonController@transactionJournals');
|
Route::get('transaction-journals/{what}', ['uses' => 'JsonController@transactionJournals','as' => 'transaction-journals']);
|
||||||
Route::get('trigger', ['uses' => 'JsonController@trigger', 'as' => 'trigger']);
|
Route::get('trigger', ['uses' => 'JsonController@trigger', 'as' => 'trigger']);
|
||||||
Route::get('action', ['uses' => 'JsonController@action', 'as' => 'action']);
|
Route::get('action', ['uses' => 'JsonController@action', 'as' => 'action']);
|
||||||
|
|
||||||
|
|||||||
@@ -40,17 +40,17 @@ class ConfirmationControllerTest extends TestCase
|
|||||||
public function testConfirmationError()
|
public function testConfirmationError()
|
||||||
{
|
{
|
||||||
// need a user that is not activated. And site must require activated users.
|
// need a user that is not activated. And site must require activated users.
|
||||||
$user = $this->user();
|
$trueConfig = new Configuration;
|
||||||
$trueConfig = new Configuration;
|
$trueConfig->data = true;
|
||||||
$trueConfig->data = true;
|
$falsePreference = new Preference;
|
||||||
|
$falsePreference->data = false;
|
||||||
|
|
||||||
$falsePreference = new Preference;
|
Preferences::shouldReceive('get')->withArgs(['user_confirmed', false])->andReturn($falsePreference);
|
||||||
$falsePreference->data = true;
|
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference);
|
||||||
|
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null);
|
||||||
Preferences::shouldReceive('get')->withArgs(['user_confirmed',false])->andReturn($falsePreference);
|
|
||||||
|
|
||||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($trueConfig);
|
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($trueConfig);
|
||||||
|
$this->be($this->user());
|
||||||
$this->call('GET', route('confirmation_error'));
|
$this->call('GET', route('confirmation_error'));
|
||||||
$this->assertResponseStatus(200);
|
$this->assertResponseStatus(200);
|
||||||
$this->see('has been sent to the address you used during your registration');
|
$this->see('has been sent to the address you used during your registration');
|
||||||
@@ -63,10 +63,23 @@ class ConfirmationControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDoConfirmation()
|
public function testDoConfirmation()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$codePreference = new Preference;
|
||||||
$this->markTestIncomplete(
|
$codePreference->data = 'abcde';
|
||||||
'This test has not been implemented yet.'
|
$timePreference = new Preference;
|
||||||
);
|
$timePreference->data = 0;
|
||||||
|
$falsePreference = new Preference;
|
||||||
|
$falsePreference->data = false;
|
||||||
|
|
||||||
|
Preferences::shouldReceive('get')->withArgs(['user_confirmed_code'])->andReturn($codePreference);
|
||||||
|
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);
|
||||||
|
Preferences::shouldReceive('get')->withArgs(['user_confirmed', false])->andReturn($falsePreference);
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('do_confirm_account', ['abcde']));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertRedirectedToRoute('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,10 +88,27 @@ class ConfirmationControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testResendConfirmation()
|
public function testResendConfirmation()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$trueConfig = new Configuration;
|
||||||
$this->markTestIncomplete(
|
$trueConfig->data = true;
|
||||||
'This test has not been implemented yet.'
|
$codePreference = new Preference;
|
||||||
);
|
$codePreference->data = 'abcde';
|
||||||
|
$timePreference = new Preference;
|
||||||
|
$timePreference->data = 0;
|
||||||
|
$falsePreference = new Preference;
|
||||||
|
$falsePreference->data = false;
|
||||||
|
|
||||||
|
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);
|
||||||
|
Preferences::shouldReceive('get')->withArgs(['user_confirmed', false])->andReturn($falsePreference);
|
||||||
|
|
||||||
|
// from event handler:
|
||||||
|
Preferences::shouldReceive('setForUser')->withAnyArgs()->once();
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('resend_confirmation'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user