diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index 41ad31e2f3..79cbfd9580 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -370,10 +370,11 @@ class BudgetController extends Controller
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
- // set value so create routine will not overwrite URL:
+ // @codeCoverageIgnoreStart
$request->session()->put('budgets.create.fromStore', true);
return redirect(route('budgets.create'))->withInput();
+ // @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('budgets.create.uri'));
@@ -394,10 +395,11 @@ class BudgetController extends Controller
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
- // set value so edit routine will not overwrite URL:
+ // @codeCoverageIgnoreStart
$request->session()->put('budgets.edit.fromUpdate', true);
return redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]);
+ // @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('budgets.edit.uri'));
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index 2eedbf128c..4fba001c4b 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -265,8 +265,8 @@ class CategoryController extends Controller
$end = Navigation::endOfPeriod($start, $range);
$subTitle = trans(
'firefly.journals_in_period_for_category',
- ['name' => $category->name,
- 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
+ ['name' => $category->name,
+ 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
$periods = $this->getPeriodOverview($category);
}
@@ -278,7 +278,8 @@ class CategoryController extends Controller
$periods = $this->getPeriodOverview($category);
$subTitle = trans(
'firefly.journals_in_period_for_category',
- ['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
+ ['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
+ 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
// grab journals, but be prepared to jump a period back to get the right ones:
@@ -304,7 +305,8 @@ class CategoryController extends Controller
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_category',
- ['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
+ ['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
+ 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
@@ -327,9 +329,11 @@ class CategoryController extends Controller
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
+ // @codeCoverageIgnoreStart
$request->session()->put('categories.create.fromStore', true);
return redirect(route('categories.create'))->withInput();
+ // @codeCoverageIgnoreEnd
}
return redirect(route('categories.index'));
@@ -352,9 +356,11 @@ class CategoryController extends Controller
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
+ // @codeCoverageIgnoreStart
$request->session()->put('categories.edit.fromUpdate', true);
return redirect(route('categories.edit', [$category->id]));
+ // @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('categories.edit.uri'));
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 9773032f9b..203628861f 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -120,9 +120,11 @@ class Controller extends BaseController
}
}
+ // @codeCoverageIgnoreStart
Session::flash('error', strval(trans('firefly.cannot_redirect_to_account')));
return redirect(route('index'));
+ // @codeCoverageIgnoreEnd
}
/**
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index 67615e167a..813183d1cb 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -291,7 +291,7 @@ class TagController extends Controller
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
-
+
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_tag',
diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php
index e866173605..e5956cb305 100644
--- a/tests/Feature/Controllers/AccountControllerTest.php
+++ b/tests/Feature/Controllers/AccountControllerTest.php
@@ -53,6 +53,7 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::delete
+ * @covers \FireflyIII\Http\Controllers\Controller::rememberPreviousUri
*/
public function testDelete()
{
@@ -73,6 +74,8 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::destroy
+ * @covers \FireflyIII\Http\Controllers\Controller::__construct
+ * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri
*/
public function testDestroy()
{
@@ -83,7 +86,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['accounts.delete.url' => 'http://localhost/accounts/show/1']);
+ $this->session(['accounts.delete.uri' => 'http://localhost/accounts/show/1']);
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
$this->be($this->user());
@@ -316,6 +319,7 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::store
+ * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri
*/
public function testStore()
{
@@ -326,7 +330,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make());
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['accounts.create.url' => 'http://localhost']);
+ $this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'new account ' . rand(1000, 9999),
@@ -340,6 +344,7 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::store
+ * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri
*/
public function testStoreAnother()
{
@@ -350,7 +355,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make());
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['accounts.create.url' => 'http://localhost']);
+ $this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'new account ' . rand(1000, 9999),
@@ -365,6 +370,7 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::update
+ * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri
*/
public function testUpdate()
{
@@ -375,7 +381,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['accounts.edit.url' => 'http://localhost']);
+ $this->session(['accounts.edit.uri' => 'http://localhost/javascript/account']);
$this->be($this->user());
$data = [
'name' => 'updated account ' . rand(1000, 9999),
@@ -390,6 +396,7 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\AccountController::update
+ * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri
*/
public function testUpdateAgain()
{
@@ -400,7 +407,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['accounts.edit.url' => 'http://localhost']);
+ $this->session(['accounts.edit.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'updated account ' . rand(1000, 9999),
diff --git a/tests/Feature/Controllers/AttachmentControllerTest.php b/tests/Feature/Controllers/AttachmentControllerTest.php
index 1dda189fe5..271767907a 100644
--- a/tests/Feature/Controllers/AttachmentControllerTest.php
+++ b/tests/Feature/Controllers/AttachmentControllerTest.php
@@ -45,7 +45,7 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['attachments.delete.url' => 'http://localhost']);
+ $this->session(['attachments.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('attachments.destroy', [1]));
$response->assertStatus(302);
@@ -127,7 +127,7 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['attachments.edit.url' => 'http://localhost']);
+ $this->session(['attachments.edit.uri' => 'http://localhost']);
$data = [
'title' => 'Some updated title ' . rand(1000, 9999),
'notes' => '',
diff --git a/tests/Feature/Controllers/BillControllerTest.php b/tests/Feature/Controllers/BillControllerTest.php
index 1ed607ed76..123ae4301e 100644
--- a/tests/Feature/Controllers/BillControllerTest.php
+++ b/tests/Feature/Controllers/BillControllerTest.php
@@ -67,7 +67,7 @@ class BillControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['bills.delete.url' => 'http://localhost']);
+ $this->session(['bills.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('bills.destroy', [1]));
$response->assertStatus(302);
@@ -199,7 +199,7 @@ class BillControllerTest extends TestCase
'date' => '2016-01-01',
'repeat_freq' => 'monthly',
];
- $this->session(['bills.create.url' => 'http://localhost']);
+ $this->session(['bills.create.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('bills.store'), $data);
$response->assertStatus(302);
@@ -228,7 +228,7 @@ class BillControllerTest extends TestCase
'date' => '2016-01-01',
'repeat_freq' => 'monthly',
];
- $this->session(['bills.edit.url' => 'http://localhost']);
+ $this->session(['bills.edit.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('bills.update', [1]), $data);
$response->assertStatus(302);
diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.php
index 5149bea555..b79a537f54 100644
--- a/tests/Feature/Controllers/BudgetControllerTest.php
+++ b/tests/Feature/Controllers/BudgetControllerTest.php
@@ -103,7 +103,7 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
- $this->session(['budgets.delete.url' => 'http://localhost']);
+ $this->session(['budgets.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('budgets.destroy', [1]));
$response->assertStatus(302);
@@ -137,6 +137,13 @@ class BudgetControllerTest extends TestCase
public function testIndex(string $range)
{
// mock stuff
+ $budget = factory(Budget::class)->make();
+ $budgetLimit = factory(BudgetLimit::class)->make();
+
+ // set budget limit to current month:
+ $budgetLimit->start_date = Carbon::now()->startOfMonth();
+ $budgetLimit->end_date = Carbon::now()->endOfMonth();
+
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
@@ -144,9 +151,11 @@ class BudgetControllerTest extends TestCase
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$repository->shouldReceive('cleanupBudgets');
- $repository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
+ $repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]));
$repository->shouldReceive('getInactiveBudgets')->andReturn(new Collection);
$repository->shouldReceive('getAvailableBudget')->andReturn('100.123');
+ $repository->shouldReceive('spentInPeriod')->andReturn('-1');
+ $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$this->be($this->user());
@@ -292,6 +301,9 @@ class BudgetControllerTest extends TestCase
public function testShow(string $range)
{
// mock stuff
+
+ $budgetLimit = factory(BudgetLimit::class)->make();
+
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
@@ -308,8 +320,8 @@ class BudgetControllerTest extends TestCase
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$repository = $this->mock(BudgetRepositoryInterface::class);
- $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
- $repository->shouldReceive('spentInPeriod')->andReturn('1');
+ $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
+ $repository->shouldReceive('spentInPeriod')->andReturn('-1');
$date = new Carbon();
$date->subDay();
@@ -322,6 +334,22 @@ class BudgetControllerTest extends TestCase
$response->assertSee('
');
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\BudgetController::showByBudgetLimit
+ * @expectedExceptionMessage This budget limit is not part of
+ *
+ */
+ public function testShowByBadBudgetLimit()
+ {
+ // mock stuff
+ $journalRepos = $this->mock(JournalRepositoryInterface::class);
+ $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
+
+ $this->be($this->user());
+ $response = $this->get(route('budgets.show.limit', [1, 8]));
+ $response->assertStatus(500);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\BudgetController::showByBudgetLimit()
* @dataProvider dateRangeProvider
@@ -375,7 +403,7 @@ class BudgetControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('find')->andReturn($budget);
$repository->shouldReceive('store')->andReturn($budget);
- $this->session(['budgets.create.url' => 'http://localhost']);
+ $this->session(['budgets.create.uri' => 'http://localhost']);
$data = [
'name' => 'New Budget ' . rand(1000, 9999),
@@ -399,7 +427,7 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('find')->andReturn($budget);
$repository->shouldReceive('update');
- $this->session(['budgets.edit.url' => 'http://localhost']);
+ $this->session(['budgets.edit.uri' => 'http://localhost']);
$data = [
'name' => 'Updated Budget ' . rand(1000, 9999),
diff --git a/tests/Feature/Controllers/CategoryControllerTest.php b/tests/Feature/Controllers/CategoryControllerTest.php
index 48de5b5359..e8f7ccc705 100644
--- a/tests/Feature/Controllers/CategoryControllerTest.php
+++ b/tests/Feature/Controllers/CategoryControllerTest.php
@@ -71,7 +71,7 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
- $this->session(['categories.delete.url' => 'http://localhost']);
+ $this->session(['categories.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('categories.destroy', [1]));
$response->assertStatus(302);
@@ -220,6 +220,47 @@ class CategoryControllerTest extends TestCase
$response->assertSee('');
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\CategoryController::show
+ * @covers \FireflyIII\Http\Controllers\CategoryController::getPeriodOverview
+ *
+ * @dataProvider dateRangeProvider
+ *
+ * @param string $range
+ */
+ public function testShowEmpty(string $range)
+ {
+ $journalRepos = $this->mock(JournalRepositoryInterface::class);
+ $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
+
+ // mock stuff
+ $repository = $this->mock(CategoryRepositoryInterface::class);
+ $repository->shouldReceive('firstUseDate')->once()->andReturn(new Carbon);
+ $repository->shouldReceive('spentInPeriod')->andReturn('0');
+ $repository->shouldReceive('earnedInPeriod')->andReturn('0');
+
+ $accountRepos = $this->mock(AccountRepositoryInterface::class);
+ $accountRepos->shouldReceive('getAccountsByType')->once()->andReturn(new Collection);
+
+ $collector = $this->mock(JournalCollectorInterface::class);
+ $collector->shouldReceive('setPage')->andReturnSelf()->times(3);
+ $collector->shouldReceive('setLimit')->andReturnSelf()->times(3);
+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3);
+ $collector->shouldReceive('setRange')->andReturnSelf()->times(3);
+ $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3);
+ $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3);
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3);
+
+ $collector->shouldReceive('setCategory')->andReturnSelf()->times(3);
+ $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3);
+
+ $this->be($this->user());
+ $this->changeDateRange($this->user(), $range);
+ $response = $this->get(route('categories.show', [1]));
+ $response->assertStatus(200);
+ $response->assertSee('');
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\CategoryController::show
* @covers \FireflyIII\Http\Controllers\CategoryController::getPeriodOverview
@@ -326,7 +367,7 @@ class CategoryControllerTest extends TestCase
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10))->once();
- $repository->shouldReceive('firstUseDate')->once()->andReturn(new Carbon);
+ $repository->shouldReceive('firstUseDate')->once()->andReturn(new Carbon('1900-01-01'));
$repository->shouldReceive('spentInPeriod')->andReturn('-1');
$repository->shouldReceive('earnedInPeriod')->andReturn('1');
@@ -349,7 +390,7 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('find')->andReturn(new Category);
$repository->shouldReceive('store')->andReturn(new Category);
- $this->session(['categories.create.url' => 'http://localhost']);
+ $this->session(['categories.create.uri' => 'http://localhost']);
$data = [
'name' => 'New Category ' . rand(1000, 9999),
@@ -371,7 +412,7 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('update');
$repository->shouldReceive('find')->andReturn(new Category);
- $this->session(['categories.edit.url' => 'http://localhost']);
+ $this->session(['categories.edit.uri' => 'http://localhost']);
$data = [
'name' => 'Updated Category ' . rand(1000, 9999),
diff --git a/tests/Feature/Controllers/CurrencyControllerTest.php b/tests/Feature/Controllers/CurrencyControllerTest.php
index 6795973aca..13008128b8 100644
--- a/tests/Feature/Controllers/CurrencyControllerTest.php
+++ b/tests/Feature/Controllers/CurrencyControllerTest.php
@@ -89,7 +89,7 @@ class CurrencyControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['currencies.delete.url' => 'http://localhost']);
+ $this->session(['currencies.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('currencies.destroy', [1]));
$response->assertStatus(302);
@@ -143,7 +143,7 @@ class CurrencyControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new TransactionCurrency);
- $this->session(['currencies.create.url' => 'http://localhost']);
+ $this->session(['currencies.create.uri' => 'http://localhost']);
$data = [
'name' => 'XX',
'code' => 'XXX',
@@ -167,7 +167,7 @@ class CurrencyControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->andReturn(new TransactionCurrency);
- $this->session(['currencies.edit.url' => 'http://localhost']);
+ $this->session(['currencies.edit.uri' => 'http://localhost']);
$data = [
'name' => 'XA',
'code' => 'XAX',
diff --git a/tests/Feature/Controllers/PiggyBankControllerTest.php b/tests/Feature/Controllers/PiggyBankControllerTest.php
index c5342504d4..1004d41efd 100644
--- a/tests/Feature/Controllers/PiggyBankControllerTest.php
+++ b/tests/Feature/Controllers/PiggyBankControllerTest.php
@@ -106,7 +106,7 @@ class PiggyBankControllerTest extends TestCase
$repository->shouldReceive('destroy')->andReturn(true);
- $this->session(['piggy-banks.delete.url' => 'http://localhost']);
+ $this->session(['piggy-banks.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('piggy-banks.destroy', [2]));
$response->assertStatus(302);
@@ -294,7 +294,7 @@ class PiggyBankControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new PiggyBank);
- $this->session(['piggy-banks.create.url' => 'http://localhost']);
+ $this->session(['piggy-banks.create.uri' => 'http://localhost']);
$data = [
'name' => 'Piggy ' . rand(999, 10000),
'targetamount' => '100.123',
@@ -320,7 +320,7 @@ class PiggyBankControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->andReturn(new PiggyBank);
- $this->session(['piggy-banks.edit.url' => 'http://localhost']);
+ $this->session(['piggy-banks.edit.uri' => 'http://localhost']);
$data = [
'name' => 'Updated Piggy ' . rand(999, 10000),
'targetamount' => '100.123',
diff --git a/tests/Feature/Controllers/RuleControllerTest.php b/tests/Feature/Controllers/RuleControllerTest.php
index 7d4c6d957a..2927871e46 100644
--- a/tests/Feature/Controllers/RuleControllerTest.php
+++ b/tests/Feature/Controllers/RuleControllerTest.php
@@ -71,7 +71,7 @@ class RuleControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy');
- $this->session(['rules.delete.url' => 'http://localhost']);
+ $this->session(['rules.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('rules.destroy', [1]));
$response->assertStatus(302);
@@ -187,7 +187,7 @@ class RuleControllerTest extends TestCase
$ruleGroupRepos->shouldReceive('find')->andReturn(new RuleGroup)->once();
$repository->shouldReceive('store')->andReturn(new Rule);
- $this->session(['rules.create.url' => 'http://localhost']);
+ $this->session(['rules.create.uri' => 'http://localhost']);
$data = [
'rule_group_id' => 1,
'active' => 1,
@@ -279,7 +279,7 @@ class RuleControllerTest extends TestCase
1 => 'Bla bla',
],
];
- $this->session(['rules.edit.url' => 'http://localhost']);
+ $this->session(['rules.edit.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('rules.update', [1]), $data);
$response->assertStatus(302);
diff --git a/tests/Feature/Controllers/RuleGroupControllerTest.php b/tests/Feature/Controllers/RuleGroupControllerTest.php
index 7f962e3ff1..83fa722395 100644
--- a/tests/Feature/Controllers/RuleGroupControllerTest.php
+++ b/tests/Feature/Controllers/RuleGroupControllerTest.php
@@ -77,7 +77,7 @@ class RuleGroupControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy');
- $this->session(['rule-groups.delete.url' => 'http://localhost']);
+ $this->session(['rule-groups.delete.uri' => 'http://localhost']);
$this->be($this->user());
$response = $this->post(route('rule-groups.destroy', [1]));
$response->assertStatus(302);
@@ -178,7 +178,7 @@ class RuleGroupControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['rule-groups.create.url' => 'http://localhost']);
+ $this->session(['rule-groups.create.uri' => 'http://localhost']);
$repository->shouldReceive('store')->andReturn(new RuleGroup);
$repository->shouldReceive('find')->andReturn(new RuleGroup);
$data = [
@@ -227,7 +227,7 @@ class RuleGroupControllerTest extends TestCase
'title' => 'C',
'description' => 'XX',
];
- $this->session(['rule-groups.edit.url' => 'http://localhost']);
+ $this->session(['rule-groups.edit.uri' => 'http://localhost']);
$repository->shouldReceive('update');
$repository->shouldReceive('find')->andReturn(new RuleGroup);
diff --git a/tests/Feature/Controllers/TagControllerTest.php b/tests/Feature/Controllers/TagControllerTest.php
index 68613887ed..f6ac686e79 100644
--- a/tests/Feature/Controllers/TagControllerTest.php
+++ b/tests/Feature/Controllers/TagControllerTest.php
@@ -160,7 +160,7 @@ class TagControllerTest extends TestCase
$repository->shouldReceive('find')->andReturn(new Tag);
$repository->shouldReceive('store')->andReturn(new Tag);
- $this->session(['tags.create.url' => 'http://localhost']);
+ $this->session(['tags.create.uri' => 'http://localhost']);
$data = [
'tag' => 'Hello new tag' . rand(999, 10000),
'tagMode' => 'nothing',
@@ -182,7 +182,7 @@ class TagControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['tags.edit.url' => 'http://localhost']);
+ $this->session(['tags.edit.uri' => 'http://localhost']);
$data = [
'tag' => 'Hello updated tag' . rand(999, 10000),
'tagMode' => 'nothing',
diff --git a/tests/Feature/Controllers/Transaction/MassControllerTest.php b/tests/Feature/Controllers/Transaction/MassControllerTest.php
index 6ff71c2347..53adccc60a 100644
--- a/tests/Feature/Controllers/Transaction/MassControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/MassControllerTest.php
@@ -57,7 +57,7 @@ class MassControllerTest extends TestCase
$repository->shouldReceive('find')->andReturnValues([$deposits[0], $deposits[1]])->times(2);
$repository->shouldReceive('delete')->times(2);
- $this->session(['transactions.mass-delete.url' => 'http://localhost']);
+ $this->session(['transactions.mass-delete.uri' => 'http://localhost']);
$data = [
'confirm_mass_delete' => $depositIds,
@@ -176,7 +176,7 @@ class MassControllerTest extends TestCase
$repository->shouldReceive('find')->once()->andReturn($deposit);
- $this->session(['transactions.mass-edit.url' => 'http://localhost']);
+ $this->session(['transactions.mass-edit.uri' => 'http://localhost']);
$data = [
'journals' => [$deposit->id],
diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
index 684a2bb311..56bd1041bf 100644
--- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
@@ -93,7 +93,7 @@ class SingleControllerTest extends TestCase
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('delete')->once();
- $this->session(['transactions.delete.url' => 'http://localhost']);
+ $this->session(['transactions.delete.uri' => 'http://localhost']);
$this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->whereNull('deleted_at')->where('user_id', $this->user()->id)->first();
$response = $this->post(route('transactions.destroy', [$withdrawal->id]));
@@ -198,7 +198,7 @@ class SingleControllerTest extends TestCase
$journal->description = 'New journal';
$repository->shouldReceive('store')->andReturn($journal);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $this->session(['transactions.create.url' => 'http://localhost']);
+ $this->session(['transactions.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
@@ -242,7 +242,7 @@ class SingleControllerTest extends TestCase
$attachmentRepo->shouldReceive('getMessages')->andReturn($messages);
- $this->session(['transactions.create.url' => 'http://localhost']);
+ $this->session(['transactions.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
@@ -281,7 +281,7 @@ class SingleControllerTest extends TestCase
$repository->shouldReceive('update')->andReturn($journal);
$repository->shouldReceive('first')->times(2)->andReturn(new TransactionJournal);
- $this->session(['transactions.edit.url' => 'http://localhost']);
+ $this->session(['transactions.edit.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'id' => 123,
diff --git a/tests/Feature/Controllers/Transaction/SplitControllerTest.php b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
index 2773fc7f38..00c5a5b3c6 100644
--- a/tests/Feature/Controllers/Transaction/SplitControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SplitControllerTest.php
@@ -111,7 +111,7 @@ class SplitControllerTest extends TestCase
*/
public function testUpdate()
{
- $this->session(['transactions.edit-split.url' => 'http://localhost']);
+ $this->session(['transactions.edit-split.uri' => 'http://localhost']);
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = [
'id' => $deposit->id,
@@ -158,7 +158,7 @@ class SplitControllerTest extends TestCase
*/
public function testUpdateOpeningBalance()
{
- $this->session(['transactions.edit-split.url' => 'http://localhost']);
+ $this->session(['transactions.edit-split.uri' => 'http://localhost']);
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
$data = [
'id' => $opening->id,
diff --git a/tests/Feature/Controllers/TransactionControllerTest.php b/tests/Feature/Controllers/TransactionControllerTest.php
index 4cc5face03..1de5eab1e4 100644
--- a/tests/Feature/Controllers/TransactionControllerTest.php
+++ b/tests/Feature/Controllers/TransactionControllerTest.php
@@ -134,6 +134,7 @@ class TransactionControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\TransactionController::show
+ * @covers \FireflyIII\Http\Controllers\Controller::isOpeningBalance
*/
public function testShow()
{