diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index d2881eec9e..aa70075cf2 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -275,7 +275,12 @@ class JournalFormRequest extends Request $selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0); $accountCurrency = (int)($data['destination_account_currency'] ?? 0); $nativeAmount = (string)($data['native_amount'] ?? ''); + + Log::debug('Now in validateDeposit.'); + Log::debug(sprintf('SelectedCurrency is "%s", accountCurrency is "%s", native amount is "%s".', $selectedCurrency, $accountCurrency, $nativeAmount)); + if ($selectedCurrency !== $accountCurrency && '' === $nativeAmount && 0 !== $selectedCurrency && 0 !== $accountCurrency) { + Log::debug('Adding an error about missing native amount.'); $validator->errors()->add('native_amount', (string)trans('validation.numeric_native')); return; diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index 9d9707b4f1..4dcdcc5737 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -208,8 +208,10 @@ class ReportFormRequest extends Request $repository = app(TagRepositoryInterface::class); $set = $this->get('tag'); $collection = new Collection; + Log::debug('Set is:', $set ?? []); if (\is_array($set)) { foreach ($set as $tagTag) { + Log::debug(sprintf('Now searching for "%s"', $tagTag)); $tag = $repository->findByTag($tagTag); if (null !== $tag) { $collection->push($tag); diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php index 9a1873fbdd..262be2b3e3 100644 --- a/app/Http/Requests/Request.php +++ b/app/Http/Requests/Request.php @@ -27,6 +27,7 @@ use Illuminate\Foundation\Http\FormRequest; /** * Class Request. + * @codeCoverageIgnore * * @SuppressWarnings(PHPMD.NumberOfChildren) */ diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index 417e1ac71f..1e1d5c6729 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -91,11 +91,13 @@ class Amount implements ConverterInterface return $value; } + // @codeCoverageIgnoreStart Log::debug(sprintf('Final value is: "%s"', $value)); $formatted = sprintf('%01.12f', $value); Log::debug(sprintf('Is formatted to : "%s"', $formatted)); return $formatted; + // @codeCoverageIgnoreEnd } /** diff --git a/tests/Feature/Controllers/Recurring/CreateControllerTest.php b/tests/Feature/Controllers/Recurring/CreateControllerTest.php index fd0d4aec4e..d3951546ce 100644 --- a/tests/Feature/Controllers/Recurring/CreateControllerTest.php +++ b/tests/Feature/Controllers/Recurring/CreateControllerTest.php @@ -132,6 +132,171 @@ class CreateControllerTest extends TestCase $response->assertSessionHas('success'); } + /** + * @covers \FireflyIII\Http\Controllers\Recurring\CreateController + * @covers \FireflyIII\Http\Requests\RecurrenceFormRequest + */ + public function testStoreYearly(): void + { + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $budgetRepos = $this->mock(BudgetRepositoryInterface::class); + $categoryRepos = $this->mock(CategoryRepositoryInterface::class); + $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); + + $tomorrow = Carbon::create()->addDays(2); + $recurrence = $this->user()->recurrences()->first(); + $data = [ + 'title' => 'hello' . random_int(1, 100000), + 'first_date' => $tomorrow->format('Y-m-d'), + 'repetition_type' => 'yearly,2018-01-01', + 'skip' => 0, + 'recurring_description' => 'Some descr' . random_int(1, 100000), + 'active' => '1', + 'apply_rules' => '1', + 'foreign_amount' => '1', + 'foreign_currency_id' => '2', + + // mandatory for transaction: + 'transaction_description' => 'Some descr', + 'transaction_type' => 'withdrawal', + 'transaction_currency_id' => '1', + 'amount' => '30', + + // mandatory account info: + 'source_id' => '1', + 'destination_name' => 'Some Expense', + + // optional fields: + 'budget_id' => '1', + 'category' => 'CategoryA', + 'tags' => 'A,B,C', + 'create_another' => '1', + 'repetition_end' => 'times', + 'repetitions' => 3, + ]; + + $recurringRepos->shouldReceive('store')->andReturn($recurrence)->once(); + + $this->be($this->user()); + $response = $this->post(route('recurring.store'), $data); + $response->assertStatus(302); + $response->assertSessionHas('success'); + } + + /** + * @covers \FireflyIII\Http\Controllers\Recurring\CreateController + * @covers \FireflyIII\Http\Requests\RecurrenceFormRequest + */ + public function testStoreMonthly(): void + { + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $budgetRepos = $this->mock(BudgetRepositoryInterface::class); + $categoryRepos = $this->mock(CategoryRepositoryInterface::class); + $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); + + $tomorrow = Carbon::create()->addDays(2); + $recurrence = $this->user()->recurrences()->first(); + $data = [ + 'title' => 'hello' . random_int(1, 100000), + 'first_date' => $tomorrow->format('Y-m-d'), + 'repetition_type' => 'monthly,5', + 'skip' => 0, + 'recurring_description' => 'Some descr' . random_int(1, 100000), + 'active' => '1', + 'apply_rules' => '1', + 'foreign_amount' => '1', + 'foreign_currency_id' => '2', + + // mandatory for transaction: + 'transaction_description' => 'Some descr', + 'transaction_type' => 'withdrawal', + 'transaction_currency_id' => '1', + 'amount' => '30', + + // mandatory account info: + 'source_id' => '1', + 'destination_name' => 'Some Expense', + + // optional fields: + 'budget_id' => '1', + 'category' => 'CategoryA', + 'tags' => 'A,B,C', + 'create_another' => '1', + 'repetition_end' => 'times', + 'repetitions' => 3, + ]; + + $recurringRepos->shouldReceive('store')->andReturn($recurrence)->once(); + + $this->be($this->user()); + $response = $this->post(route('recurring.store'), $data); + $response->assertStatus(302); + $response->assertSessionHas('success'); + } + + /** + * @covers \FireflyIII\Http\Controllers\Recurring\CreateController + * @covers \FireflyIII\Http\Requests\RecurrenceFormRequest + */ + public function testStoreNdom(): void + { + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $budgetRepos = $this->mock(BudgetRepositoryInterface::class); + $categoryRepos = $this->mock(CategoryRepositoryInterface::class); + $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); + $recurringRepos = $this->mock(RecurringRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); + + $tomorrow = Carbon::create()->addDays(2); + $recurrence = $this->user()->recurrences()->first(); + $data = [ + 'title' => 'hello' . random_int(1, 100000), + 'first_date' => $tomorrow->format('Y-m-d'), + 'repetition_type' => 'ndom,3,5', + 'skip' => 0, + 'recurring_description' => 'Some descr' . random_int(1, 100000), + 'active' => '1', + 'apply_rules' => '1', + 'foreign_amount' => '1', + 'foreign_currency_id' => '2', + + // mandatory for transaction: + 'transaction_description' => 'Some descr', + 'transaction_type' => 'withdrawal', + 'transaction_currency_id' => '1', + 'amount' => '30', + + // mandatory account info: + 'source_id' => '1', + 'destination_name' => 'Some Expense', + + // optional fields: + 'budget_id' => '1', + 'category' => 'CategoryA', + 'tags' => 'A,B,C', + 'create_another' => '1', + 'repetition_end' => 'times', + 'repetitions' => 3, + ]; + + $recurringRepos->shouldReceive('store')->andReturn($recurrence)->once(); + + $this->be($this->user()); + $response = $this->post(route('recurring.store'), $data); + $response->assertStatus(302); + $response->assertSessionHas('success'); + } + /** * @covers \FireflyIII\Http\Controllers\Recurring\CreateController * @covers \FireflyIII\Http\Requests\RecurrenceFormRequest diff --git a/tests/Feature/Controllers/ReportControllerTest.php b/tests/Feature/Controllers/ReportControllerTest.php index f2bb7b0151..80aa67524a 100644 --- a/tests/Feature/Controllers/ReportControllerTest.php +++ b/tests/Feature/Controllers/ReportControllerTest.php @@ -600,6 +600,7 @@ class ReportControllerTest extends TestCase */ public function testPostIndexTagOK(): void { + Log::debug(sprintf('Now in test %s', __METHOD__)); $accountRepos = $this->mock(AccountRepositoryInterface::class); $budgetRepository = $this->mock(BudgetRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -608,14 +609,18 @@ class ReportControllerTest extends TestCase $userRepos = $this->mock(UserRepositoryInterface::class); /** @var Tag $tag */ - $tag = $this->user()->tags()->find(1); + $tag = $this->user()->tags()->find(1); + $tag2 = $this->user()->tags()->find(3); + $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); - $tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice(); + + $tagRepos->shouldReceive('findByTag')->andReturn($tag, null)->times(4); + $tagRepos->shouldReceive('findNull')->andReturn($tag2)->times(3); $data = [ 'accounts' => ['1'], - 'tag' => ['housing'], + 'tag' => ['housing', '3'], 'daterange' => '2016-01-01 - 2016-01-31', 'report_type' => 'tag', ]; @@ -623,7 +628,44 @@ class ReportControllerTest extends TestCase $this->be($this->user()); $response = $this->post(route('reports.index.post'), $data); $response->assertStatus(302); - $response->assertRedirect(route('reports.report.tag', ['1', $tag->id, '20160101', '20160131'])); + $response->assertRedirect(route('reports.report.tag', ['1', $tag->id . ',' . $tag2->id, '20160101', '20160131'])); + } + + /** + * @covers \FireflyIII\Http\Controllers\ReportController + * @covers \FireflyIII\Http\Requests\ReportFormRequest + */ + public function testPostIndexTagOKNoID(): void + { + Log::debug(sprintf('Now in test %s', __METHOD__)); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $budgetRepository = $this->mock(BudgetRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $categoryRepos = $this->mock(CategoryRepositoryInterface::class); + $tagRepos = $this->mock(TagRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + + /** @var Tag $tag */ + $tag = $this->user()->tags()->find(1); + $tag2 = $this->user()->tags()->find(3); + + $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); + $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); + + $tagRepos->shouldReceive('findByTag')->andReturn(null)->times(4); + $tagRepos->shouldReceive('findNull')->andReturn($tag2)->times(4); + + $data = [ + 'accounts' => ['1'], + 'tag' => ['housing', '3'], + 'daterange' => '2016-01-01 - 2016-01-31', + 'report_type' => 'tag', + ]; + + $this->be($this->user()); + $response = $this->post(route('reports.index.post'), $data); + $response->assertStatus(302); + $response->assertRedirect(route('reports.report.tag', ['1', $tag2->id . ',' . $tag2->id, '20160101', '20160131'])); } /** diff --git a/tests/Feature/Controllers/Rule/CreateControllerTest.php b/tests/Feature/Controllers/Rule/CreateControllerTest.php index 3ff9635131..78a6321ca0 100644 --- a/tests/Feature/Controllers/Rule/CreateControllerTest.php +++ b/tests/Feature/Controllers/Rule/CreateControllerTest.php @@ -80,8 +80,8 @@ class CreateControllerTest extends TestCase public function testCreateFromBill(): void { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); - $billRepos = $this->mock(BillRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $billRepos = $this->mock(BillRepositoryInterface::class); $ruleRepos = $this->mock(RuleRepositoryInterface::class); $ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class); @@ -114,7 +114,7 @@ class CreateControllerTest extends TestCase $this->session(['_old_input' => $old]); // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $ruleRepos = $this->mock(RuleRepositoryInterface::class); $ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class); @@ -138,8 +138,8 @@ class CreateControllerTest extends TestCase public function testStore(): void { // mock stuff - $repository = $this->mock(RuleRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(RuleRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class); @@ -149,22 +149,26 @@ class CreateControllerTest extends TestCase $this->session(['rules.create.uri' => 'http://localhost']); $data = [ - 'rule_group_id' => 1, - 'active' => 1, - 'title' => 'A', - 'trigger' => 'store-journal', - 'description' => 'D', - 'rule-trigger' => [ - 1 => 'from_account_starts', + 'rule_group_id' => 1, + 'active' => 1, + 'title' => 'A', + 'trigger' => 'store-journal', + 'description' => 'D', + 'rule_triggers' => [ + [ + 'name' => 'description_is', + 'value' => 'A', + 'stop_processing' => '0', + + ], ], - 'rule-trigger-value' => [ - 1 => 'B', - ], - 'rule-action' => [ - 1 => 'set_category', - ], - 'rule-action-value' => [ - 1 => 'C', + 'rule_actions' => [ + [ + 'name' => 'set_category', + 'value' => 'C', + 'stop_processing' => '0', + + ], ], ]; $this->be($this->user()); diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.php index 5381a619fd..40eeb17276 100644 --- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php +++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php @@ -77,7 +77,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -111,7 +111,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -140,7 +140,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -167,7 +167,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -193,7 +193,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -216,7 +216,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); @@ -243,7 +243,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('setUser')->once(); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); @@ -290,7 +290,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -339,7 +339,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -388,7 +388,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $journalRepos->shouldReceive('getTransactionType')->andReturn('Reconciliation')->once(); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); @@ -416,7 +416,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -448,7 +448,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); @@ -470,7 +470,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -520,7 +520,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -564,7 +564,7 @@ class SingleControllerTest extends TestCase $attRepos = $this->mock(AttachmentHelperInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('setUser')->once(); @@ -603,6 +603,47 @@ class SingleControllerTest extends TestCase $response->assertSee('