Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Expand test coverage.
James Colea7b8470d9ea5
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.phpindex eb2244ca15..c9c787d092 100644--- a/app/Factory/TransactionFactory.php+++ b/app/Factory/TransactionFactory.php@@ -56,10 +56,10 @@ class TransactionFactory$currencyId = $data['currency_id'] ?? null;$currencyId = isset($data['currency']) ? $data['currency']->id : $currencyId;if ('' === $data['amount']) {- throw new FireflyException('Amount is an empty string, which Firefly III cannot handle. Apologies.');+ throw new FireflyException('Amount is an empty string, which Firefly III cannot handle. Apologies.'); // @codeCoverageIgnore}if (null === $currencyId) {- throw new FireflyException('Cannot store transaction without currency information.');+ throw new FireflyException('Cannot store transaction without currency information.'); // @codeCoverageIgnore}$data['foreign_amount'] = '' === (string)$data['foreign_amount'] ? null : $data['foreign_amount'];Log::debug(sprintf('Create transaction for account #%d ("%s") with amount %s', $data['account']->id, $data['account']->name, $data['amount']));diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.phpindex 906b7e39fe..72a00bab0c 100644--- a/app/Helpers/Attachments/AttachmentHelper.php+++ b/app/Helpers/Attachments/AttachmentHelper.php@@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Attachments;use Crypt;use FireflyIII\Models\Attachment;use Illuminate\Contracts\Encryption\DecryptException;+use Illuminate\Contracts\Filesystem\FileNotFoundException;use Illuminate\Database\Eloquent\Model;use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;@@ -66,6 +67,8 @@ class AttachmentHelper implements AttachmentHelperInterface}/**+ * @codeCoverageIgnore+ ** @param Attachment $attachment** @return string@@ -74,7 +77,7 @@ class AttachmentHelper implements AttachmentHelperInterface{try {$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));- } catch (DecryptException $e) {+ } catch (DecryptException|FileNotFoundException $e) {Log::error(sprintf('Could not decrypt data of attachment #%d', $attachment->id));return '';diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex b132445c70..db68a5c841 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -210,18 +210,7 @@ class AccountController extends Controller$request->session()->flash('preFilled', $preFilled);- return view(- 'accounts.edit',- compact(- 'account',- 'currency',- 'subTitle',- 'subTitleIcon',- 'what',- 'roles',- 'preFilled'- )- );+ return view('accounts.edit', compact('account', 'currency', 'subTitle', 'subTitleIcon', 'what', 'roles', 'preFilled'));}/**@@ -340,7 +329,7 @@ class AccountController extends Controllerpublic function showAll(Request $request, Account $account){if (AccountType::INITIAL_BALANCE === $account->accountType->type) {- return $this->redirectToOriginalAccount($account);+ return $this->redirectToOriginalAccount($account); // @codeCoverageIgnore}$end = new Carbon;$today = new Carbon;diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex 59f1ec0071..ed199483d5 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -96,6 +96,7 @@ class BudgetController extends Controller// if today is between start and end, use the diff in days between end and today (days left)// otherwise, use diff between start and end.$today = new Carbon;+ Log::debug(sprintf('Start is %s, end is %s, today is %s', $start->format('Y-m-d'), $end->format('Y-m-d'),$today->format('Y-m-d')));if ($today->gte($start) && $today->lte($end)) {$days = $end->diffInDays($today);$daysInMonth = $start->diffInDays($today);diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.phpindex 4a56acf427..11f52acf5c 100644--- a/app/Http/Controllers/DebugController.php+++ b/app/Http/Controllers/DebugController.php@@ -66,6 +66,7 @@ class DebugController extends Controller$userAgent = $request->header('user-agent');$isSandstorm = var_export(env('IS_SANDSTORM', 'unknown'), true);$isDocker = var_export(env('IS_DOCKER', 'unknown'), true);+ $toSandbox = var_export(env('BUNQ_USE_SANDBOX', 'unknown'), true);$trustedProxies = env('TRUSTED_PROXIES', '(none)');$displayErrors = ini_get('display_errors');$errorReporting = $this->errorReporting((int)ini_get('error_reporting'));@@ -96,40 +97,24 @@ class DebugController extends Controllerif (null !== $logFile) {try {$logContent = file_get_contents($logFile);+ // @codeCoverageIgnoreStart} catch (Exception $e) {// don't careLog::debug(sprintf('Could not read log file. %s', $e->getMessage()));}+ // @codeCoverageIgnoreEnd}}}// last few lines- $logContent = 'Truncated from this point <----|' . substr($logContent, -4096);+ $logContent = 'Truncated from this point <----|' . substr($logContent, -8192);return view(- 'debug',- compact(- 'phpVersion',- 'extensions', 'localeAttempts',- 'appEnv',- 'appDebug',- 'appLog',- 'appLogLevel',- 'now',- 'packages',- 'drivers',- 'currentDriver',- 'userAgent',- 'displayErrors',- 'errorReporting',- 'phpOs',- 'interface',- 'logContent',- 'cacheDriver',- 'isDocker',- 'isSandstorm',- 'trustedProxies'- )+ 'debug', compact(+ 'phpVersion', 'extensions', 'localeAttempts', 'appEnv', 'appDebug', 'appLog', 'appLogLevel', 'now', 'packages', 'drivers', 'currentDriver',+ 'userAgent', 'displayErrors', 'errorReporting', 'phpOs', 'interface', 'logContent', 'cacheDriver', 'isDocker', 'isSandstorm', 'trustedProxies',+ 'toSandbox'+ ));}diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex ba32b7e7ba..993d3273e5 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -133,10 +133,12 @@ class HomeController extends ControllerLog::debug('Call twig:clean...');try {Artisan::call('twig:clean');+ // @codeCoverageIgnoreStart} catch (Exception $e) {- // dont care+ // don't careLog::debug('Called twig:clean.');}+ // @codeCoverageIgnoreEndLog::debug('Call view:clear...');Artisan::call('view:clear');Log::debug('Done! Redirecting...');diff --git a/app/Http/Controllers/Import/IndexController.php b/app/Http/Controllers/Import/IndexController.phpindex c416cb8c98..a6fe9d3167 100644--- a/app/Http/Controllers/Import/IndexController.php+++ b/app/Http/Controllers/Import/IndexController.php@@ -156,8 +156,9 @@ class IndexController extends Controllerpublic function download(ImportJob $job): LaravelResponse{Log::debug('Now in download()', ['job' => $job->key]);- $config = $job->configuration;+ $config = $this->repository->getConfiguration($job);// This is CSV import specific:+ $config['delimiter'] = $config['delimiter'] ?? ',';$config['delimiter'] = "\t" === $config['delimiter'] ? 'tab' : $config['delimiter'];// this prevents private information from escapingdiff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.phpindex d47992d9ed..0ebb2d5192 100644--- a/app/Http/Controllers/JavascriptController.php+++ b/app/Http/Controllers/JavascriptController.php@@ -29,6 +29,7 @@ use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use Illuminate\Http\Request;+use Illuminate\Http\Response;use Log;use Preferences;@@ -68,9 +69,9 @@ class JavascriptController extends Controller/*** @param CurrencyRepositoryInterface $repository*- * @return \Illuminate\Http\Response+ * @return Response*/- public function currencies(CurrencyRepositoryInterface $repository)+ public function currencies(CurrencyRepositoryInterface $repository): Response{$currencies = $repository->get();$data = ['currencies' => []];@@ -102,7 +103,8 @@ class JavascriptController extends Controller}/** @var TransactionCurrency $currency */$currency = $currencyRepository->findNull($currencyId);- if (0 === $currencyId) {+ if (null === $currency) {+ /** @var TransactionCurrency $currency */$currency = app('amount')->getDefaultCurrency();}diff --git a/app/Http/Controllers/Json/AutoCompleteController.php b/app/Http/Controllers/Json/AutoCompleteController.phpindex b01069520e..6ff6c92e1d 100644--- a/app/Http/Controllers/Json/AutoCompleteController.php+++ b/app/Http/Controllers/Json/AutoCompleteController.php@@ -35,6 +35,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use FireflyIII\Support\CacheProperties;+use Illuminate\Http\JsonResponse;/*** Class AutoCompleteController.@@ -47,7 +48,7 @@ class AutoCompleteController extends Controller** @param AccountRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function allAccounts(AccountRepositoryInterface $repository){@@ -64,9 +65,9 @@ class AutoCompleteController extends Controller/*** @param JournalCollectorInterface $collector*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/- public function allTransactionJournals(JournalCollectorInterface $collector)+ public function allTransactionJournals(JournalCollectorInterface $collector): JsonResponse{$collector->setLimit(250)->setPage(1);$return = array_unique($collector->getJournals()->pluck('description')->toArray());@@ -80,9 +81,9 @@ class AutoCompleteController extends Controller** @param BillRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/- public function bills(BillRepositoryInterface $repository)+ public function bills(BillRepositoryInterface $repository): JsonResponse{$return = array_unique($repository->getActiveBills()->pluck('name')->toArray()@@ -95,7 +96,7 @@ class AutoCompleteController extends Controller/*** @param BudgetRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function budgets(BudgetRepositoryInterface $repository){@@ -110,7 +111,7 @@ class AutoCompleteController extends Controller** @param CategoryRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function categories(CategoryRepositoryInterface $repository){@@ -123,7 +124,7 @@ class AutoCompleteController extends Controller/*** @param CurrencyRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function currencyNames(CurrencyRepositoryInterface $repository){@@ -138,7 +139,7 @@ class AutoCompleteController extends Controller** @param AccountRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function expenseAccounts(AccountRepositoryInterface $repository){@@ -163,7 +164,7 @@ class AutoCompleteController extends Controller* @param JournalCollectorInterface $collector* @param TransactionJournal $except*- * @return \Illuminate\Http\JsonResponse|mixed+ * @return JsonResponse|mixed*/public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except){@@ -195,7 +196,7 @@ class AutoCompleteController extends Controller/*** @param AccountRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function revenueAccounts(AccountRepositoryInterface $repository){@@ -220,7 +221,7 @@ class AutoCompleteController extends Controller** @param TagRepositoryInterface $tagRepository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function tags(TagRepositoryInterface $tagRepository){@@ -234,7 +235,7 @@ class AutoCompleteController extends Controller* @param JournalCollectorInterface $collector* @param string $what*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function transactionJournals(JournalCollectorInterface $collector, string $what){@@ -251,7 +252,7 @@ class AutoCompleteController extends Controller/*** @param JournalRepositoryInterface $repository*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/public function transactionTypes(JournalRepositoryInterface $repository){diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.phpindex 12c9923f6c..581f88b35d 100644--- a/app/Http/Controllers/ProfileController.php+++ b/app/Http/Controllers/ProfileController.php@@ -424,7 +424,7 @@ class ProfileController extends Controller/****/- private function createOAuthKeys()+ private function createOAuthKeys(): void{$rsa = new RSA();$keys = $rsa->createKey(4096);@@ -437,11 +437,13 @@ class ProfileController extends Controllerif (file_exists($publicKey) || file_exists($privateKey)) {return;}+ // @codeCoverageIgnoreStartLog::alert('NO OAuth keys were found. They have been created.');file_put_contents($publicKey, array_get($keys, 'publickey'));file_put_contents($privateKey, array_get($keys, 'privatekey'));}+ // @codeCoverageIgnoreEnd/*** @return stringdiff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.phpindex 297768f9e1..98a781017c 100644--- a/app/Http/Controllers/RuleController.php+++ b/app/Http/Controllers/RuleController.php@@ -352,12 +352,12 @@ class RuleController extends Controller// redirect to show bill.if ($request->get('return_to_bill') === 'true' && (int)$request->get('bill_id') > 0) {- return redirect(route('bills.show', [(int)$request->get('bill_id')]));+ return redirect(route('bills.show', [(int)$request->get('bill_id')])); // @codeCoverageIgnore}// redirect to new bill creation.if ((int)$request->get('bill_id') > 0) {- return redirect($this->getPreviousUri('bills.create.uri'));+ return redirect($this->getPreviousUri('bills.create.uri')); // @codeCoverageIgnore}@@ -403,10 +403,12 @@ class RuleController extends Controller$matcher->setTriggers($triggers);try {$matchingTransactions = $matcher->findTransactionsByTriggers();+ // @codeCoverageIgnoreStart} catch (FireflyException $exception) {Log::error(sprintf('Could not grab transactions in testTriggers(): %s', $exception->getMessage()));Log::error($exception->getTraceAsString());}+ // @codeCoverageIgnoreStart// Warn the user if only a subset of transactions is returned@@ -422,10 +424,12 @@ class RuleController extends Controller$view = 'ERROR, see logs.';try {$view = view('list.journals-tiny', ['transactions' => $matchingTransactions])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $exception) {Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));Log::error($exception->getTraceAsString());}+ // @codeCoverageIgnoreEndreturn response()->json(['html' => $view, 'warning' => $warning]);}@@ -461,10 +465,12 @@ class RuleController extends Controller$matcher->setRule($rule);try {$matchingTransactions = $matcher->findTransactionsByRule();+ // @codeCoverageIgnoreStart} catch (FireflyException $exception) {Log::error(sprintf('Could not grab transactions in testTriggersByRule(): %s', $exception->getMessage()));Log::error($exception->getTraceAsString());}+ // @codeCoverageIgnoreEnd// Warn the user if only a subset of transactions is returned$warning = '';@@ -479,10 +485,12 @@ class RuleController extends Controller$view = 'ERROR, see logs.';try {$view = view('list.journals-tiny', ['transactions' => $matchingTransactions])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $exception) {Log::error(sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage()));Log::error($exception->getTraceAsString());}+ // @codeCoverageIgnoreEndreturn response()->json(['html' => $view, 'warning' => $warning]);}@@ -587,10 +595,12 @@ class RuleController extends Controller'count' => 1,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));Log::error($e->getTraceAsString());}+ // @codeCoverageIgnoreEndreturn $actions;}@@ -620,10 +630,12 @@ class RuleController extends Controller'count' => $count,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));Log::error($e->getTraceAsString());}+ // @codeCoverageIgnoreEnd++$index;}@@ -655,10 +667,12 @@ class RuleController extends Controller'count' => $count,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));Log::error($e->getTraceAsString());}+ // @codeCoverageIgnoreEnd++$index;}}@@ -691,10 +705,12 @@ class RuleController extends Controller'count' => $count,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::debug(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage()));Log::error($e->getTraceAsString());}+ // @codeCoverageIgnoreEnd++$newIndex;}@@ -727,10 +743,12 @@ class RuleController extends Controller'count' => $count,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));Log::error($e->getTraceAsString());}+ // @codeCoverageIgnoreEnd++$newIndex;}@@ -786,10 +804,12 @@ class RuleController extends Controller'count' => 4,])->render();+ // @codeCoverageIgnoreStart} catch (Throwable $e) {Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));Log::debug($e->getTraceAsString());}+ // @codeCoverageIgnoreEndreturn $triggers;}diff --git a/app/Models/Rule.php b/app/Models/Rule.phpindex ac3cc0e992..e6e65ba73e 100644--- a/app/Models/Rule.php+++ b/app/Models/Rule.php@@ -34,6 +34,7 @@ use FireflyIII\Models\RuleAction;* Class Rule.* @property bool $stop_processing* @property int $id+ * @property \Illuminate\Support\Collection $ruleTriggers*/class Rule extends Model{diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.phpindex 3b68656a91..58265d0d1c 100644--- a/app/Models/RuleTrigger.php+++ b/app/Models/RuleTrigger.php@@ -23,10 +23,12 @@ declare(strict_types=1);namespace FireflyIII\Models;use Illuminate\Database\Eloquent\Model;-use FireflyIII\Models\Rule;/*** Class RuleTrigger.+ *+ * @property string $trigger_value+ * @property string $trigger_type*/class RuleTrigger extends Model{diff --git a/app/Models/Transaction.php b/app/Models/Transaction.phpindex bdd5253e1c..b591f1d956 100644--- a/app/Models/Transaction.php+++ b/app/Models/Transaction.php@@ -71,6 +71,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property string $description* @property bool $is_split* @property int $attachmentCount+ * @property int $transaction_currency_id*/class Transaction extends Model{diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.phpindex ef74e55f19..439962a257 100644--- a/app/Models/TransactionCurrency.php+++ b/app/Models/TransactionCurrency.php@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionJournal;* Class TransactionCurrency.** @property string $code+ * @property int $decimal_places**/class TransactionCurrency extends Modeldiff --git a/resources/views/debug.twig b/resources/views/debug.twigindex 7b8c0a26cb..7d57662635 100644--- a/resources/views/debug.twig+++ b/resources/views/debug.twig@@ -38,6 +38,7 @@ Debug information generated at {{ now }} for Firefly III version **{{ FF_VERSION{% if SANDSTORM == true %}| Sandstorm anon? | {% if SANDSTORM_ANON == true %}yes{% else %}no{% endif %} |{% endif %}| Is Sandstorm (.env) | {{ isSandstorm }} || Is Docker (.env) | {{ isDocker }} |+| bunq uses sandbox | {{ toSandbox }} || Trusted proxies (.env) | {{ trustedProxies }} || User agent | {{ userAgent }} || Loaded extensions | {{ extensions }} |diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.phpindex 290a766cc6..290b47e3b9 100644--- a/tests/Feature/Controllers/AccountControllerTest.php+++ b/tests/Feature/Controllers/AccountControllerTest.php@@ -22,6 +22,7 @@ declare(strict_types=1);namespace Tests\Feature\Controllers;+use Amount;use Carbon\Carbon;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Models\Account;@@ -159,6 +160,41 @@ class AccountControllerTest extends TestCase$response->assertSee($note->text);}+ /**+ * @covers \FireflyIII\Http\Controllers\AccountController+ */+ public function testEditNull(): void+ {+ $note = new Note();+ $note->text = 'This is a test';+ // mock stuff+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $repository = $this->mock(CurrencyRepositoryInterface::class);+ $accountRepos = $this->mock(AccountRepositoryInterface::class);++ Amount::shouldReceive('getDefaultCurrency')->andReturn(TransactionCurrency::find(2));+ $repository->shouldReceive('findNull')->once()->andReturn(null);+ $repository->shouldReceive('get')->andReturn(new Collection);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $accountRepos->shouldReceive('getNote')->andReturn($note)->once();+ $accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturnNull();+ $accountRepos->shouldReceive('getOpeningBalanceDate')->andReturnNull();+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('123');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('defaultAsset');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn('');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccMonthlyPaymentDate'])->andReturn('');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');++ $this->be($this->user());+ $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();+ $response = $this->get(route('accounts.edit', [$account->id]));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ $response->assertSee($note->text);+ }+/*** @covers \FireflyIII\Http\Controllers\AccountController::index* @covers \FireflyIII\Http\Controllers\AccountController::__construct@@ -182,7 +218,7 @@ class AccountControllerTest extends TestCaseSteam::shouldReceive('balancesByAccounts')->andReturn([$account->id => '100']);Steam::shouldReceive('getLastActivities')->andReturn([]);- $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(),'accountNumber'])->andReturn('123');+ $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('123');$this->be($this->user());$this->changeDateRange($this->user(), $range);@@ -239,6 +275,54 @@ class AccountControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}++ /**+ * @covers \FireflyIII\Http\Controllers\AccountController+ * @covers \FireflyIII\Http\Controllers\AccountController+ * @dataProvider dateRangeProvider+ *+ * @param string $range+ */+ public function testShowAll(string $range): void+ {+ $date = new Carbon;+ $this->session(['start' => $date, 'end' => clone $date]);++ // mock stuff:+ $tasker = $this->mock(AccountTaskerInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);++ $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));++ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');+ $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');++ $repository = $this->mock(AccountRepositoryInterface::class);+ $repository->shouldReceive('oldestJournalDate')->andReturn(clone $date)->once();+ $repository->shouldReceive('getMetaValue')->andReturn('');+++ $transaction = factory(Transaction::class)->make();+ $collector = $this->mock(JournalCollectorInterface::class);+ $collector->shouldReceive('setAccounts')->andReturnSelf();+ $collector->shouldReceive('setRange')->andReturnSelf();+ $collector->shouldReceive('setLimit')->andReturnSelf();+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();+ $collector->shouldReceive('setPage')->andReturnSelf();+ $collector->shouldReceive('setTypes')->andReturnSelf();+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));+ $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));++ $this->be($this->user());+ $this->changeDateRange($this->user(), $range);+ $response = $this->get(route('accounts.show.all', [1]));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }+/*** @covers \FireflyIII\Http\Controllers\AccountController::show* @expectedExceptionMessage End is after start!diff --git a/tests/Feature/Controllers/AttachmentControllerTest.php b/tests/Feature/Controllers/AttachmentControllerTest.phpindex d8f149031d..8b96a9ab78 100644--- a/tests/Feature/Controllers/AttachmentControllerTest.php+++ b/tests/Feature/Controllers/AttachmentControllerTest.php@@ -22,9 +22,11 @@ declare(strict_types=1);namespace Tests\Feature\Controllers;+use FireflyIII\Models\Attachment;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;+use Illuminate\Support\Collection;use Log;use Tests\TestCase;@@ -46,7 +48,6 @@ class AttachmentControllerTest extends TestCaseLog::debug(sprintf('Now in %s.', \get_class($this)));}-/*** @covers \FireflyIII\Http\Controllers\AttachmentController::delete*/@@ -133,6 +134,23 @@ class AttachmentControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}+ /**+ * @covers \FireflyIII\Http\Controllers\AttachmentController+ */+ public function testIndex()+ {+ $repository = $this->mock(AttachmentRepositoryInterface::class);+ $repository->shouldReceive('get')->andReturn(new Collection([Attachment::first()]))->once();+ $repository->shouldReceive('exists')->andReturn(true)->once();++ $this->be($this->user());+ $response = $this->get(route('attachments.index'));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');++ }+/*** @covers \FireflyIII\Http\Controllers\AttachmentController::update*/diff --git a/tests/Feature/Controllers/BillControllerTest.php b/tests/Feature/Controllers/BillControllerTest.phpindex 887ea957bb..5892a60dfc 100644--- a/tests/Feature/Controllers/BillControllerTest.php+++ b/tests/Feature/Controllers/BillControllerTest.php@@ -26,13 +26,18 @@ use Carbon\Carbon;use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Models\Bill;+use FireflyIII\Models\Rule;+use FireflyIII\Models\RuleGroup;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Bill\BillRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;+use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;+use FireflyIII\TransactionRules\TransactionMatcher;use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;use Log;+use Mockery;use Tests\TestCase;/**@@ -62,6 +67,7 @@ class BillControllerTest extends TestCase// mock stuff$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());@@ -79,6 +85,7 @@ class BillControllerTest extends TestCase// mock stuff$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());@@ -97,6 +104,7 @@ class BillControllerTest extends TestCase$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$repository->shouldReceive('destroy')->andReturn(true);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);@@ -115,6 +123,7 @@ class BillControllerTest extends TestCase// mock stuff$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());@@ -135,6 +144,7 @@ class BillControllerTest extends TestCase$bill = factory(Bill::class)->make();$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$collection = new Collection([$bill]);$repository->shouldReceive('getPaginator')->andReturn(new LengthAwarePaginator($collection, 1, 50))->once();@@ -156,12 +166,24 @@ class BillControllerTest extends TestCasepublic function testRescan(): void{// mock stuff+ $rule = Rule::first();$attachHelper = $this->mock(AttachmentHelperInterface::class);$journal = factory(TransactionJournal::class)->make();$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $repository->shouldReceive('getRulesForBill')->andReturn(new Collection);+ $repository->shouldReceive('getRulesForBill')->andReturn(new Collection([$rule]));++ //calls for transaction matcher:+ $matcher = $this->mock(TransactionMatcher::class);+ $matcher->shouldReceive('setLimit')->once()->withArgs([100000]);+ $matcher->shouldReceive('setRange')->once()->withArgs([100000]);+ $matcher->shouldReceive('setRule')->once()->withArgs([Mockery::any()]);+ $matcher->shouldReceive('findTransactionsByRule')->once()->andReturn(new Collection);++ $repository->shouldReceive('linkCollectionToBill')->once();+$this->be($this->user());$response = $this->get(route('bills.rescan', [1]));$response->assertStatus(302);@@ -177,6 +199,7 @@ class BillControllerTest extends TestCase$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());@@ -195,6 +218,7 @@ class BillControllerTest extends TestCase$journalRepos = $this->mock(JournalRepositoryInterface::class);$collector = $this->mock(JournalCollectorInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$repository->shouldReceive('getYearAverage')->andReturn('0');$repository->shouldReceive('getOverallAverage')->andReturn('0');$repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon);@@ -229,16 +253,55 @@ class BillControllerTest extends TestCase$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $repository->shouldReceive('store')->andReturn(new Bill);+ $attachHelper->shouldReceive('saveAttachmentsForModel');+ $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);+ $ruleGroupRepos->shouldReceive('count')->andReturn(1);+ $ruleGroupRepos->shouldReceive('getActiveGroups')->andReturn(new Collection([RuleGroup::first()]))->once();+ $data = [+ 'name' => 'New Bill ' . random_int(1000, 9999),+ 'amount_min' => '100',+ 'transaction_currency_id' => 1,+ 'skip' => 0,+ 'strict' => 1,+ 'amount_max' => '100',+ 'date' => '2016-01-01',+ 'repeat_freq' => 'monthly',+ ];+ $this->session(['bills.create.uri' => 'http://localhost']);+ $this->be($this->user());+ $response = $this->post(route('bills.store'), $data);+ $response->assertStatus(302);+ $response->assertSessionHas('success');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\BillController::store+ * @covers \FireflyIII\Http\Requests\BillFormRequest+ * @covers \FireflyIII\Http\Requests\Request+ */+ public function testStoreCreateAnother(): void+ {+ // mock stuff+ $attachHelper = $this->mock(AttachmentHelperInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$repository->shouldReceive('store')->andReturn(new Bill);$attachHelper->shouldReceive('saveAttachmentsForModel');$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);+ $ruleGroupRepos->shouldReceive('count')->andReturn(1);+ $ruleGroupRepos->shouldReceive('getActiveGroups')->andReturn(new Collection([RuleGroup::first()]))->once();$data = ['name' => 'New Bill ' . random_int(1000, 9999),'amount_min' => '100','transaction_currency_id' => 1,'skip' => 0,+ 'create_another' => '1','strict' => 1,'amount_max' => '100','date' => '2016-01-01',@@ -251,6 +314,75 @@ class BillControllerTest extends TestCase$response->assertSessionHas('success');}+ /**+ * @covers \FireflyIII\Http\Controllers\BillController::store+ * @covers \FireflyIII\Http\Requests\BillFormRequest+ * @covers \FireflyIII\Http\Requests\Request+ */+ public function testStoreNoGroup(): void+ {+ // mock stuff+ $attachHelper = $this->mock(AttachmentHelperInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $repository->shouldReceive('store')->andReturn(new Bill);+ $attachHelper->shouldReceive('saveAttachmentsForModel');+ $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);+ $ruleGroupRepos->shouldReceive('count')->andReturn(0);+ $ruleGroupRepos->shouldReceive('store')->once()->withArgs([['title' => 'Rule group for bills','description'=> 'A special rule group for all the rules that involve bills.']])->andReturn(RuleGroup::first());++ $data = [+ 'name' => 'New Bill ' . random_int(1000, 9999),+ 'amount_min' => '100',+ 'transaction_currency_id' => 1,+ 'skip' => 0,+ 'create_another' => '1',+ 'strict' => 1,+ 'amount_max' => '100',+ 'date' => '2016-01-01',+ 'repeat_freq' => 'monthly',+ ];+ $this->session(['bills.create.uri' => 'http://localhost']);+ $this->be($this->user());+ $response = $this->post(route('bills.store'), $data);+ $response->assertStatus(302);+ $response->assertSessionHas('success');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\BillController::store+ * @covers \FireflyIII\Http\Requests\BillFormRequest+ * @covers \FireflyIII\Http\Requests\Request+ */+ public function testStoreError(): void+ {+ // mock stuff+ $attachHelper = $this->mock(AttachmentHelperInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $repository->shouldReceive('store')->andReturn(null);++ $data = [+ 'name' => 'New Bill ' . random_int(1000, 9999),+ 'amount_min' => '100',+ 'transaction_currency_id' => 1,+ 'skip' => 0,+ 'strict' => 1,+ 'amount_max' => '100',+ 'date' => '2016-01-01',+ 'repeat_freq' => 'monthly',+ ];+ $this->be($this->user());+ $response = $this->post(route('bills.store'), $data);+ $response->assertStatus(302);+ $response->assertSessionHas('error');+ $response->assertRedirect(route('bills.create'));+ }+/*** @covers \FireflyIII\Http\Controllers\BillController::update* @covers \FireflyIII\Http\Requests\BillFormRequest@@ -262,20 +394,21 @@ class BillControllerTest extends TestCase$attachHelper = $this->mock(AttachmentHelperInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BillRepositoryInterface::class);+ $ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$repository->shouldReceive('update')->andReturn(new Bill);$attachHelper->shouldReceive('saveAttachmentsForModel');$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);$data = [- 'id' => 1,- 'name' => 'Updated Bill ' . random_int(1000, 9999),- 'amount_min' => '100',+ 'id' => 1,+ 'name' => 'Updated Bill ' . random_int(1000, 9999),+ 'amount_min' => '100','transaction_currency_id' => 1,- 'skip' => 0,- 'amount_max' => '100',- 'date' => '2016-01-01',- 'repeat_freq' => 'monthly',+ 'skip' => 0,+ 'amount_max' => '100',+ 'date' => '2016-01-01',+ 'repeat_freq' => 'monthly',];$this->session(['bills.edit.uri' => 'http://localhost']);$this->be($this->user());diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.phpindex 69b8ca0960..555ce40fdd 100644--- a/tests/Feature/Controllers/BudgetControllerTest.php+++ b/tests/Feature/Controllers/BudgetControllerTest.php@@ -59,6 +59,7 @@ class BudgetControllerTest extends TestCase*/public function testAmount(): void{+ Log::debug('Now in testAmount()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -74,11 +75,34 @@ class BudgetControllerTest extends TestCase$response->assertStatus(200);}+ /**+ * @covers \FireflyIII\Http\Controllers\BudgetController::amount+ */+ public function testAmountLargeDiff(): void+ {+ Log::debug('Now in testAmount()');+ // mock stuff+ $repository = $this->mock(BudgetRepositoryInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit);+ $repository->shouldReceive('spentInPeriod')->andReturn('0');+ $repository->shouldReceive('budgetedPerDay')->andReturn('10');+++ $data = ['amount' => 20000, 'start' => '2017-01-01', 'end' => '2017-01-31'];+ $this->be($this->user());+ $response = $this->post(route('budgets.amount', [1]), $data);+ $response->assertStatus(200);+ $response->assertSee('Normally you budget about \u20ac10.00 per day.');+ }+/*** @covers \FireflyIII\Http\Controllers\BudgetController::amount*/public function testAmountZero(): void{+ Log::debug('Now in testAmountZero()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -93,11 +117,35 @@ class BudgetControllerTest extends TestCase$response->assertStatus(200);}+ /**+ * @covers \FireflyIII\Http\Controllers\BudgetController::amount+ */+ public function testAmountOutOfRange(): void+ {+ Log::debug('Now in testAmountOutOfRange()');+ // mock stuff+ $repository = $this->mock(BudgetRepositoryInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit);+ $repository->shouldReceive('spentInPeriod')->andReturn('0');+ $repository->shouldReceive('budgetedPerDay')->andReturn('10');++ $today = new Carbon;+ $start = $today->startOfMonth()->format('Y-m-d');+ $end = $today->endOfMonth()->format('Y-m-d');+ $data = ['amount' => 200, 'start' => $start, 'end' => $end];+ $this->be($this->user());+ $response = $this->post(route('budgets.amount', [1]), $data);+ $response->assertStatus(200);+ }+/*** @covers \FireflyIII\Http\Controllers\BudgetController::create*/public function testCreate(): void{+ Log::debug('Now in testCreate()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -115,6 +163,7 @@ class BudgetControllerTest extends TestCase*/public function testDelete(): void{+ Log::debug('Now in testDelete()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -132,6 +181,7 @@ class BudgetControllerTest extends TestCase*/public function testDestroy(): void{+ Log::debug('Now in testDestroy()');// mock stuff$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository = $this->mock(BudgetRepositoryInterface::class);@@ -151,6 +201,7 @@ class BudgetControllerTest extends TestCase*/public function testEdit(): void{+ Log::debug('Now in testEdit()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -172,6 +223,7 @@ class BudgetControllerTest extends TestCase*/public function testIndex(string $range): void{+ Log::debug(sprintf('Now in testIndex(%s)', $range));// mock stuff$budget = factory(Budget::class)->make();$budgetLimit = factory(BudgetLimit::class)->make();@@ -209,6 +261,7 @@ class BudgetControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}+/*** @covers \FireflyIII\Http\Controllers\BudgetController::index* @covers \FireflyIII\Http\Controllers\BudgetController::__construct@@ -218,6 +271,7 @@ class BudgetControllerTest extends TestCase*/public function testIndexWithDate(string $range): void{+ Log::debug(sprintf('Now in testIndexWithDate(%s)', $range));// mock stuff$budget = factory(Budget::class)->make();$budgetLimit = factory(BudgetLimit::class)->make();@@ -255,6 +309,57 @@ class BudgetControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}+++ /**+ * @covers \FireflyIII\Http\Controllers\BudgetController::index+ * @covers \FireflyIII\Http\Controllers\BudgetController::__construct+ * @dataProvider dateRangeProvider+ *+ * @param string $range+ */+ public function testIndexOutOfRange(string $range): void+ {+ Log::debug(sprintf('Now in testIndexOutOfRange(%s)', $range));+ // mock stuff+ $budget = factory(Budget::class)->make();+ $budgetLimit = factory(BudgetLimit::class)->make();+ $budgetInfo = [+ $budget->id => [+ 'spent' => '0',+ 'budgeted' => '0',+ 'currentRep' => false,+ ],+ ];++ // 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);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);++ $repository->shouldReceive('cleanupBudgets');+ $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]));+ $repository->shouldReceive('collectBudgetInformation')->andReturn($budgetInfo);++ $this->be($this->user());+ $today = new Carbon;+ $today->startOfMonth();+ $this->changeDateRange($this->user(), $range);+ $response = $this->get(route('budgets.index', [$today->format('Y-m-d')]));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }+/*** @covers \FireflyIII\Http\Controllers\BudgetController::index* @covers \FireflyIII\Http\Controllers\BudgetController::__construct@@ -264,6 +369,7 @@ class BudgetControllerTest extends TestCase*/public function testIndexWithInvalidDate(string $range): void{+ Log::debug(sprintf('Now in testIndexWithInvalidDate(%s)', $range));// mock stuff$budget = factory(Budget::class)->make();$budgetLimit = factory(BudgetLimit::class)->make();@@ -306,6 +412,7 @@ class BudgetControllerTest extends TestCase*/public function testInfoIncome(): void{+ Log::debug('Now in testInfoIncome()');// mock stuff$accountRepos = $this->mock(AccountRepositoryInterface::class);$repository = $this->mock(BudgetRepositoryInterface::class);@@ -327,6 +434,7 @@ class BudgetControllerTest extends TestCase*/public function testInfoIncomeExpanded(string $range): void{+ Log::debug(sprintf('Now in testInfoIncomeExpanded(%s)', $range));// mock stuff$accountRepos = $this->mock(AccountRepositoryInterface::class);$repository = $this->mock(BudgetRepositoryInterface::class);@@ -350,11 +458,13 @@ class BudgetControllerTest extends TestCase*/public function testNoBudget(string $range): void{+ Log::debug(sprintf('Now in testNoBudget(%s)', $range));+// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$collector = $this->mock(JournalCollectorInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());+ $journalRepos->shouldReceive('firstNull')->andReturn(null);$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();$collector->shouldReceive('setRange')->andReturnSelf();@@ -385,11 +495,12 @@ class BudgetControllerTest extends TestCase*/public function testNoBudgetAll(string $range): void{+ Log::debug(sprintf('Now in testNoBudgetAll(%s)', $range));// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$collector = $this->mock(JournalCollectorInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());+ $journalRepos->shouldReceive('firstNull')->andReturn(null);$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();$collector->shouldReceive('setRange')->andReturnSelf();@@ -422,11 +533,12 @@ class BudgetControllerTest extends TestCase*/public function testNoBudgetDate(string $range): void{+ Log::debug(sprintf('Now in testNoBudgetDate(%s)', $range));// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$collector = $this->mock(JournalCollectorInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());+ $journalRepos->shouldReceive('firstNull')->andReturn(null);$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();$collector->shouldReceive('setRange')->andReturnSelf();@@ -454,6 +566,7 @@ class BudgetControllerTest extends TestCase*/public function testPostUpdateIncome(): void{+ Log::debug('Now in testPostUpdateIncome()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -476,6 +589,7 @@ class BudgetControllerTest extends TestCase*/public function testShow(string $range): void{+ Log::debug(sprintf('Now in testShow(%s)', $range));// mock stuff$budgetLimit = factory(BudgetLimit::class)->make();@@ -516,6 +630,7 @@ class BudgetControllerTest extends TestCase*/public function testShowByBadBudgetLimit(): void{+ Log::debug('Now in testShowByBadBudgetLimit()');// mock stuff$repository = $this->mock(BudgetRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);@@ -534,6 +649,7 @@ class BudgetControllerTest extends TestCase*/public function testShowByBudgetLimit(string $range): void{+ Log::debug(sprintf('Now in testShowByBudgetLimit(%s)', $range));// mock stuff$journalRepos = $this->mock(JournalRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);@@ -570,6 +686,7 @@ class BudgetControllerTest extends TestCase*/public function testStore(): void{+ Log::debug('Now in testStore()');// mock stuff$budget = factory(Budget::class)->make();$repository = $this->mock(BudgetRepositoryInterface::class);@@ -595,6 +712,7 @@ class BudgetControllerTest extends TestCase*/public function testUpdate(): void{+ Log::debug('Now in testUpdate()');// mock stuff$budget = factory(Budget::class)->make();$repository = $this->mock(BudgetRepositoryInterface::class);@@ -621,6 +739,7 @@ class BudgetControllerTest extends TestCase*/public function testUpdateIncome(): void{+ Log::debug('Now in testUpdateIncome()');// must be in list$this->be($this->user());diff --git a/tests/Feature/Controllers/Chart/AccountControllerTest.php b/tests/Feature/Controllers/Chart/AccountControllerTest.phpindex 082706ce69..a06bbad564 100644--- a/tests/Feature/Controllers/Chart/AccountControllerTest.php+++ b/tests/Feature/Controllers/Chart/AccountControllerTest.php@@ -317,13 +317,13 @@ class AccountControllerTest extends TestCasepublic function testReport(): void{$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);- $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));+ $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1), null);$generator = $this->mock(GeneratorInterface::class);$generator->shouldReceive('multiSet')->andReturn([]);Steam::shouldReceive('balanceInRange')->andReturn(['2012-01-01' => '0']);$this->be($this->user());- $response = $this->get(route('chart.account.report', ['1', '20120101', '20120131']));+ $response = $this->get(route('chart.account.report', ['1,2', '20120101', '20120131']));$response->assertStatus(200);}diff --git a/tests/Feature/Controllers/Import/IndexControllerTest.php b/tests/Feature/Controllers/Import/IndexControllerTest.phpindex c053ed74c4..76026e0227 100644--- a/tests/Feature/Controllers/Import/IndexControllerTest.php+++ b/tests/Feature/Controllers/Import/IndexControllerTest.php@@ -191,6 +191,43 @@ class IndexControllerTest extends TestCase$response->assertRedirect(route('import.job.configuration.index', ['file_job_1']));}+ /**+ * @covers \FireflyIII\Http\Controllers\Import\IndexController+ */+ public function testDownload(): void+ {+ // mock stuff:+ $repository = $this->mock(ImportJobRepositoryInterface::class);+ $userRepository = $this->mock(UserRepositoryInterface::class);+ $fakePrerequisites = $this->mock(FakePrerequisites::class);+ $bunqPrerequisites = $this->mock(BunqPrerequisites::class);+ $spectrePrerequisites = $this->mock(SpectrePrerequisites::class);+ $filePrerequisites = $this->mock(FilePrerequisites::class);++ $job = new ImportJob;+ $job->user_id = $this->user()->id;+ $job->key = 'dc_' . random_int(1, 1000);+ $job->status = 'ready_to_run';+ $job->stage = 'go-for-import';+ $job->provider = 'file';+ $job->file_type = '';+ $job->configuration = [];+ $job->save();++ $fakeConfig = [+ 'hi' => 'there',+ 1 => true,+ 'column-mapping-config' => ['a', 'b', 'c'],+ ];++ $repository->shouldReceive('getConfiguration')->andReturn($fakeConfig)->once();++ $this->be($this->user());+ $response = $this->get(route('import.job.download', [$job->key]));+ $response->assertStatus(200);+ $response->assertExactJson(['column-mapping-config' => [], 'delimiter' => ',', 'hi' => 'there', 1 => true]);+ }+/*** @covers \FireflyIII\Http\Controllers\Import\IndexController*/diff --git a/tests/Feature/Controllers/Import/JobStatusControllerTest.php b/tests/Feature/Controllers/Import/JobStatusControllerTest.phpindex 2a85e2895f..a966948dd2 100644--- a/tests/Feature/Controllers/Import/JobStatusControllerTest.php+++ b/tests/Feature/Controllers/Import/JobStatusControllerTest.php@@ -80,7 +80,7 @@ class JobStatusControllerTest extends TestCase$job->user_id = $this->user()->id;$job->key = 'Bfake_job_' . random_int(1, 1000);$job->status = 'ready_to_run';- $job->provider = 'fake';+ $job->provider = 'file';$job->transactions = [];$job->file_type = '';$job->save();diff --git a/tests/Feature/Controllers/JavascriptControllerTest.php b/tests/Feature/Controllers/JavascriptControllerTest.phpindex 25fbda206f..b4f0b30905 100644--- a/tests/Feature/Controllers/JavascriptControllerTest.php+++ b/tests/Feature/Controllers/JavascriptControllerTest.php@@ -22,6 +22,7 @@ declare(strict_types=1);namespace Tests\Feature\Controllers;+use Amount;use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;use FireflyIII\Models\TransactionCurrency;@@ -29,8 +30,8 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use Illuminate\Support\Collection;use Log;-use Tests\TestCase;use Mockery;+use Tests\TestCase;/*** Class JavascriptControllerTest@@ -63,7 +64,7 @@ class JavascriptControllerTest extends TestCase$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]))->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->once();$currencyRepos->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(new TransactionCurrency);- $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(),'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$this->be($this->user());$response = $this->get(route('javascript.accounts'));@@ -80,7 +81,6 @@ class JavascriptControllerTest extends TestCase$repository->shouldReceive('get')->andReturn(new Collection([$currency]));-$this->be($this->user());$response = $this->get(route('javascript.currencies'));$response->assertStatus(200);@@ -100,7 +100,33 @@ class JavascriptControllerTest extends TestCase$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$accountRepos->shouldReceive('findNull')->andReturn(new Account);$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));- $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(),'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');+ $this->be($this->user());+ $this->changeDateRange($this->user(), $range);+ $response = $this->get(route('javascript.variables'));+ $response->assertStatus(200);+ }+++ /**+ * @covers \FireflyIII\Http\Controllers\JavascriptController::variables+ * @covers \FireflyIII\Http\Controllers\JavascriptController::getDateRangeConfig+ *+ * @param string $range+ *+ * @dataProvider dateRangeProvider+ */+ public function testVariablesNull(string $range): void+ {+ Amount::shouldReceive('getDefaultCurrency')->andReturn(TransactionCurrency::find(1))->times(2);+ Amount::shouldReceive('getJsConfig')->andReturn([])->once();++ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);+ $accountRepos->shouldReceive('findNull')->andReturn(new Account);+ $currencyRepos->shouldReceive('findNull')->andReturn(null);++ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$this->be($this->user());$this->changeDateRange($this->user(), $range);$response = $this->get(route('javascript.variables'));@@ -121,7 +147,7 @@ class JavascriptControllerTest extends TestCase$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);$accountRepos->shouldReceive('findNull')->andReturn(new Account);$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));- $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(),'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');$this->be($this->user());$this->changeDateRange($this->user(), $range);diff --git a/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php b/tests/Feature/Controllers/Json/AutoCompleteControllerTest.phpindex cc165747d1..d35cbe837c 100644--- a/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php+++ b/tests/Feature/Controllers/Json/AutoCompleteControllerTest.php@@ -25,13 +25,17 @@ namespace Tests\Feature\Controllers\Json;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;+use FireflyIII\Models\Bill;use FireflyIII\Models\Budget;use FireflyIII\Models\Category;use FireflyIII\Models\Tag;+use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Account\AccountRepositoryInterface;+use FireflyIII\Repositories\Bill\BillRepositoryInterface;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use FireflyIII\Repositories\Category\CategoryRepositoryInterface;+use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use Illuminate\Support\Collection;@@ -75,7 +79,7 @@ class AutoCompleteControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController::allTransactionJournals+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController*/public function testAllTransactionJournals(): void{@@ -90,7 +94,39 @@ class AutoCompleteControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController::budgets+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController+ */+ public function testBills(): void+ {+ $repository = $this->mock(BillRepositoryInterface::class);+ $bills = factory(Bill::class, 10)->make();++ $repository->shouldReceive('getActiveBills')->andReturn($bills);++ $this->be($this->user());+ $response = $this->get(route('json.bills'));+ $response->assertStatus(200);+ }+++ /**+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController+ */+ public function testCurrencyNames(): void+ {+ $repository = $this->mock(CurrencyRepositoryInterface::class);++ $currency = TransactionCurrency::find(1);+ $repository->shouldReceive('get')->andReturn(new Collection([$currency]))->once();++ $this->be($this->user());+ $response = $this->get(route('json.currency-names'));+ $response->assertStatus(200);+ $response->assertExactJson(['Euro']);+ }++ /**+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController*/public function testBudgets(): void{@@ -107,7 +143,7 @@ class AutoCompleteControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController::categories+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController*/public function testCategories(): void{@@ -124,7 +160,7 @@ class AutoCompleteControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController::expenseAccounts+ * @covers \FireflyIII\Http\Controllers\Json\AutoCompleteController*/public function testExpenseAccounts(): void{diff --git a/tests/Feature/Controllers/Json/BoxControllerTest.php b/tests/Feature/Controllers/Json/BoxControllerTest.phpindex 70f99765d0..377d139d50 100644--- a/tests/Feature/Controllers/Json/BoxControllerTest.php+++ b/tests/Feature/Controllers/Json/BoxControllerTest.php@@ -24,6 +24,7 @@ namespace Tests\Feature\Controllers\Json;use Carbon\Carbon;use FireflyIII\Helpers\Collector\JournalCollectorInterface;+use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Bill\BillRepositoryInterface;@@ -49,7 +50,7 @@ class BoxControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Json\BoxController::available+ * @covers \FireflyIII\Http\Controllers\Json\BoxController*/public function testAvailable(): void{@@ -69,6 +70,27 @@ class BoxControllerTest extends TestCase}+ /**+ * @covers \FireflyIII\Http\Controllers\Json\BoxController+ */+ public function testAvailableDays(): void+ {+ $return = [+ 0 => [+ 'spent' => '-800', // more than budgeted.+ ],+ ];+ $repository = $this->mock(BudgetRepositoryInterface::class);+ $repository->shouldReceive('getAvailableBudget')->andReturn('1000');+ $repository->shouldReceive('getActiveBudgets')->andReturn(new Collection);+ $repository->shouldReceive('collectBudgetInformation')->andReturn($return);++ $this->be($this->user());+ $response = $this->get(route('json.box.available'));+ $response->assertStatus(200);++ }+/*** @covers \FireflyIII\Http\Controllers\Json\BoxController::balance*/@@ -90,6 +112,31 @@ class BoxControllerTest extends TestCase$response->assertStatus(200);}+ /**+ * @covers \FireflyIII\Http\Controllers\Json\BoxController::balance+ */+ public function testBalanceTransactions(): void+ {+ $transaction = new Transaction;+ $transaction->transaction_currency_id = 1;+ $transaction->transaction_amount ='5';++ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $collector = $this->mock(JournalCollectorInterface::class);++ // try a collector for income:+ /** @var JournalCollectorInterface $collector */+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();+ $collector->shouldReceive('setRange')->andReturnSelf();+ $collector->shouldReceive('setTypes')->andReturnSelf();+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));++ $this->be($this->user());+ $response = $this->get(route('json.box.balance'));+ $response->assertStatus(200);+ }+/*** @covers \FireflyIII\Http\Controllers\Json\BoxController::bills*/@@ -121,6 +168,42 @@ class BoxControllerTest extends TestCase$response->assertStatus(200);}+ /**+ * @covers \FireflyIII\Http\Controllers\Json\BoxController::netWorth()+ */+ public function testNetWorthVirtual(): void+ {+ $account = $this->user()->accounts()->first();+ $account->virtual_balance = '1000';+ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);+ $accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$account]));+ $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');++ $this->be($this->user());+ $response = $this->get(route('json.box.net-worth'));+ $response->assertStatus(200);+ }++ /**+ * @covers \FireflyIII\Http\Controllers\Json\BoxController::netWorth()+ */+ public function testNetWorthNoCurrency(): void+ {+ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);+ $accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));+ $currencyRepos->shouldReceive('findNull')->andReturn(null);+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');+ $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');++ $this->be($this->user());+ $response = $this->get(route('json.box.net-worth'));+ $response->assertStatus(200);+ }+/*** @covers \FireflyIII\Http\Controllers\Json\BoxController::netWorth()*/diff --git a/tests/Feature/Controllers/NewUserControllerTest.php b/tests/Feature/Controllers/NewUserControllerTest.phpindex 0e9a3e45ac..103b04b4cf 100644--- a/tests/Feature/Controllers/NewUserControllerTest.php+++ b/tests/Feature/Controllers/NewUserControllerTest.php@@ -50,8 +50,7 @@ class NewUserControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\NewUserController::index- * @covers \FireflyIII\Http\Controllers\NewUserController::__construct+ * @covers \FireflyIII\Http\Controllers\NewUserController*/public function testIndex(): void{@@ -68,8 +67,7 @@ class NewUserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\NewUserController::index- * @covers \FireflyIII\Http\Controllers\NewUserController::__construct+ * @covers \FireflyIII\Http\Controllers\NewUserController*/public function testIndexExisting(): void{@@ -86,9 +84,7 @@ class NewUserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\NewUserController::submit- * @covers \FireflyIII\Http\Controllers\NewUserController::createAssetAccount- * @covers \FireflyIII\Http\Controllers\NewUserController::createSavingsAccount+ * @covers \FireflyIII\Http\Controllers\NewUserController*/public function testSubmit(): void{@@ -114,7 +110,34 @@ class NewUserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\NewUserController::submit+ * @covers \FireflyIII\Http\Controllers\NewUserController+ */+ public function testSubmitNull(): void+ {+ // mock stuff+ $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);+ $accountRepos = $this->mock(AccountRepositoryInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $accountRepos->shouldReceive('store')->times(3);+ $currencyRepos->shouldReceive('findNull')->andReturn(null);+ $currencyRepos->shouldReceive('findByCodeNull')->withArgs(['EUR'])->andReturn(TransactionCurrency::find(2))->once();++ $data = [+ 'bank_name' => 'New bank',+ 'savings_balance' => '1000',+ 'bank_balance' => '100',+ 'language' => 'en_US',+ 'amount_currency_id_bank_balance' => 1,+ ];+ $this->be($this->emptyUser());+ $response = $this->post(route('new-user.submit'), $data);+ $response->assertStatus(302);+ $response->assertSessionHas('success');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\NewUserController*/public function testSubmitSingle(): void{diff --git a/tests/Feature/Controllers/PiggyBankControllerTest.php b/tests/Feature/Controllers/PiggyBankControllerTest.phpindex 8ee5612be5..5361a41471 100644--- a/tests/Feature/Controllers/PiggyBankControllerTest.php+++ b/tests/Feature/Controllers/PiggyBankControllerTest.php@@ -34,6 +34,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;use Illuminate\Support\Collection;use Log;+use Mockery;use Steam;use Tests\TestCase;@@ -57,7 +58,7 @@ class PiggyBankControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::add+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testAdd(): void{@@ -74,7 +75,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::addMobile+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testAddMobile(): void{@@ -92,7 +93,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::create+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testCreate(): void{@@ -124,7 +125,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::delete+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testDelete(): void{@@ -139,7 +140,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::destroy+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testDestroy(): void{@@ -159,7 +160,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::edit+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testEdit(): void{@@ -189,8 +190,8 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::index- * @covers \FireflyIII\Http\Controllers\PiggyBankController::__construct+ * @covers \FireflyIII\Http\Controllers\PiggyBankController+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testIndex(): void{@@ -217,7 +218,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testPostAdd(): void{@@ -239,7 +240,7 @@ class PiggyBankControllerTest extends TestCase/*** Add way too much*- * @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testPostAddTooMuch(): void{@@ -258,7 +259,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::postRemove+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testPostRemove(): void{@@ -278,7 +279,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::postRemove+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testPostRemoveTooMuch(): void{@@ -297,7 +298,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::remove+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testRemove(): void{@@ -311,7 +312,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::removeMobile+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testRemoveMobile(): void{@@ -326,7 +327,25 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::show+ * Test setting of order/+ *+ * @covers \FireflyIII\Http\Controllers\PiggyBankController+ */+ public function testSetOrder(): void+ {+ // mock stuff+ $repository = $this->mock(PiggyBankRepositoryInterface::class);+ $repository->shouldReceive('setOrder')->once()->withArgs([Mockery::any(), 3])->andReturn(false);++ $data = ['order' => '3'];+ $this->be($this->user());+ $response = $this->post(route('piggy-banks.set-order', [1]), $data);+ $response->assertStatus(200);+ $response->assertExactJson(['data' => 'OK']);+ }++ /**+ * @covers \FireflyIII\Http\Controllers\PiggyBankController*/public function testShow(): void{@@ -340,7 +359,6 @@ class PiggyBankControllerTest extends TestCase$repository->shouldReceive('getCurrentAmount')->andReturn('1');-$this->be($this->user());$response = $this->get(route('piggy-banks.show', [1]));$response->assertStatus(200);@@ -348,7 +366,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::store+ * @covers \FireflyIII\Http\Controllers\PiggyBankController* @covers \FireflyIII\Http\Requests\PiggyBankFormRequest*/public function testStore(): void@@ -374,7 +392,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\PiggyBankController::update+ * @covers \FireflyIII\Http\Controllers\PiggyBankController* @covers \FireflyIII\Http\Requests\PiggyBankFormRequest*/public function testUpdate(): voiddiff --git a/tests/Feature/Controllers/ProfileControllerTest.php b/tests/Feature/Controllers/ProfileControllerTest.phpindex 8530e1f825..d1d433b4aa 100644--- a/tests/Feature/Controllers/ProfileControllerTest.php+++ b/tests/Feature/Controllers/ProfileControllerTest.php@@ -30,6 +30,7 @@ use FireflyIII\User;use Google2FA;use Illuminate\Support\Collection;use Log;+use Mockery;use Preferences;use Tests\TestCase;@@ -108,7 +109,7 @@ class ProfileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\ProfileController::confirmEmailChange()+ * @covers \FireflyIII\Http\Controllers\ProfileController::confirmEmailChange()*/public function testConfirmEmailWithToken(): void{@@ -158,8 +159,112 @@ class ProfileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\ProfileController::index- * @covers \FireflyIII\Http\Controllers\ProfileController::__construct+ * @covers \FireflyIII\Http\Controllers\ProfileController+ */+ public function testEnable2FADemo(): void+ {+ $repository = $this->mock(UserRepositoryInterface::class);+ $repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(true);++ $this->be($this->user());+ $response = $this->post(route('profile.enable2FA'));+ $response->assertStatus(302);+ $response->assertRedirect(route('profile.index'));+ }++ /**+ * @covers \FireflyIII\Http\Controllers\ProfileController+ */+ public function testEnable2FANoSecret(): void+ {+ $repository = $this->mock(UserRepositoryInterface::class);+ $repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);++ // ask about language:+ $langPreference = new Preference;+ $langPreference->data = 'en_US';+ Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference)->times(2);++ // ask about twoFactorAuthEnabled+ $truePref = new Preference;+ $truePref->data = true;+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->times(1);++ // ask about range+ $rangePref = new Preference;+ $rangePref->data = '1M';+ Preferences::shouldReceive('get')->withArgs(['viewRange', '1M'])->andReturn($rangePref)->once();++ // ask about list length:+ $listPref = new Preference;+ $listPref->data = '50';+ Preferences::shouldReceive('get')->withArgs(['list-length', '10'])->andReturn($listPref)->once();+++ // ask about currency+ $currencyPref = new Preference;+ $currencyPref->data = 'EUR';+ Preferences::shouldReceive('getForUser')->once()->withArgs([Mockery::any(), 'currencyPreference', 'EUR'])->andReturn($currencyPref);+ Preferences::shouldReceive('lastActivity')->once();+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->twice()->andReturnNull();++ $this->be($this->user());+ $response = $this->post(route('profile.enable2FA'));+ $response->assertStatus(302);+ $response->assertRedirect(route('profile.code'));+ }++ /**+ * @covers \FireflyIII\Http\Controllers\ProfileController+ */+ public function testEnable2FASecret(): void+ {+ $repository = $this->mock(UserRepositoryInterface::class);+ $repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);++ // ask about language:+ $langPreference = new Preference;+ $langPreference->data = 'en_US';+ Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference)->times(2);++ // ask about twoFactorAuthEnabled+ $truePref = new Preference;+ $truePref->data = true;+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->times(1);++ // ask about range+ $rangePref = new Preference;+ $rangePref->data = '1M';+ Preferences::shouldReceive('get')->withArgs(['viewRange', '1M'])->andReturn($rangePref)->once();++ // ask about list length:+ $listPref = new Preference;+ $listPref->data = '50';+ Preferences::shouldReceive('get')->withArgs(['list-length', '10'])->andReturn($listPref)->once();++ $secretPref= new Preference;+ $secretPref->data = 'X';+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->twice()->andReturn(null,$secretPref);++ // set pref+ Preferences::shouldReceive('set')->once()->withArgs(['twoFactorAuthEnabled', 1]);+++ // ask about currency+ $currencyPref = new Preference;+ $currencyPref->data = 'EUR';+ Preferences::shouldReceive('getForUser')->once()->withArgs([Mockery::any(), 'currencyPreference', 'EUR'])->andReturn($currencyPref);+ Preferences::shouldReceive('lastActivity')->once();+++ $this->be($this->user());+ $response = $this->post(route('profile.enable2FA'));+ $response->assertStatus(302);+ $response->assertRedirect(route('profile.index'));+ }++ /**+ * @covers \FireflyIII\Http\Controllers\ProfileController*/public function testIndex(): void{diff --git a/tests/Feature/Controllers/RuleControllerTest.php b/tests/Feature/Controllers/RuleControllerTest.phpindex b6e1926fd2..7446ac9d5a 100644--- a/tests/Feature/Controllers/RuleControllerTest.php+++ b/tests/Feature/Controllers/RuleControllerTest.php@@ -25,19 +25,22 @@ namespace Tests\Feature\Controllers;use Carbon\Carbon;use FireflyIII\Jobs\ExecuteRuleOnExistingTransactions;use FireflyIII\Jobs\Job;+use FireflyIII\Models\Bill;use FireflyIII\Models\Rule;use FireflyIII\Models\RuleGroup;use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Account\AccountRepositoryInterface;+use FireflyIII\Repositories\Bill\BillRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Rule\RuleRepositoryInterface;use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;use FireflyIII\TransactionRules\TransactionMatcher;use Illuminate\Support\Collection;+use Log;use Queue;use Tests\TestCase;-use Log;+/*** Class RuleControllerTest*@@ -58,24 +61,45 @@ class RuleControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\RuleController::create+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testCreate(): void{// mock stuff$journalRepos = $this->mock(JournalRepositoryInterface::class);+ $billRepos = $this->mock(BillRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$this->be($this->user());$response = $this->get(route('rules.create', [1]));$response->assertStatus(200);$response->assertSee('<ol class="breadcrumb">');+ $response->assertViewHas('returnToBill', false);+ $response->assertViewHas('bill', null);}/**- * @covers \FireflyIII\Http\Controllers\RuleController::create- * @covers \FireflyIII\Http\Controllers\RuleController::getPreviousTriggers- * @covers \FireflyIII\Http\Controllers\RuleController::getPreviousActions+ * @covers \FireflyIII\Http\Controllers\RuleController+ */+ public function testCreateBill(): void+ {+ // mock stuff+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $billRepos = $this->mock(BillRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $billRepos->shouldReceive('find')->withArgs([1])->andReturn(Bill::find(1))->once();++ $this->be($this->user());+ $response = $this->get(route('rules.create', [1]) . '?return=true&fromBill=1');+ $response->assertStatus(200);+ $response->assertSee('<ol class="breadcrumb">');+ $response->assertViewHas('returnToBill', true);+ }++ /**+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testCreatePreviousInput(): void{@@ -100,7 +124,24 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::delete+ * @covers \FireflyIII\Http\Controllers\RuleController+ */+ public function testCreateReturn(): void+ {+ // mock stuff+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $billRepos = $this->mock(BillRepositoryInterface::class);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);++ $this->be($this->user());+ $response = $this->get(route('rules.create', [1]) . '?return=true');+ $response->assertStatus(200);+ $response->assertSee('<ol class="breadcrumb">');+ $response->assertViewHas('returnToBill', true);+ }++ /**+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testDelete(): void{@@ -115,7 +156,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::destroy+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testDestroy(): void{@@ -134,7 +175,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::down+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testDown(): void{@@ -151,9 +192,9 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::edit- * @covers \FireflyIII\Http\Controllers\RuleController::getCurrentActions- * @covers \FireflyIII\Http\Controllers\RuleController::getCurrentTriggers+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testEdit(): void{@@ -172,9 +213,9 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::edit- * @covers \FireflyIII\Http\Controllers\RuleController::getPreviousActions- * @covers \FireflyIII\Http\Controllers\RuleController::getPreviousTriggers+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testEditPreviousInput(): void{@@ -203,7 +244,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::execute+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testExecute(): void{@@ -233,10 +274,10 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::index- * @covers \FireflyIII\Http\Controllers\RuleController::__construct- * @covers \FireflyIII\Http\Controllers\RuleController::createDefaultRule- * @covers \FireflyIII\Http\Controllers\RuleController::createDefaultRuleGroup+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testIndex(): void{@@ -259,7 +300,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::reorderRuleActions+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testReorderRuleActions(): void{@@ -277,7 +318,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::reorderRuleTriggers+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testReorderRuleTriggers(): void{@@ -295,7 +336,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::selectTransactions()+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testSelectTransactions(): void{@@ -309,7 +350,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::store+ * @covers \FireflyIII\Http\Controllers\RuleController* @covers \FireflyIII\Http\Requests\RuleFormRequest*/public function testStore(): void@@ -349,8 +390,8 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::testTriggers- * @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testTestTriggers(): void{@@ -377,7 +418,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::testTriggersByRule()+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testTestTriggersByRule(): void{@@ -398,8 +439,8 @@ class RuleControllerTest extends TestCase/*** This actually hits an error and not the actually code but OK.*- * @covers \FireflyIII\Http\Controllers\RuleController::testTriggers- * @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testTestTriggersError(): void{@@ -413,8 +454,8 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::testTriggers- * @covers \FireflyIII\Http\Controllers\RuleController::getValidTriggerList+ * @covers \FireflyIII\Http\Controllers\RuleController+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testTestTriggersMax(): void{@@ -442,7 +483,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::up+ * @covers \FireflyIII\Http\Controllers\RuleController*/public function testUp(): void{@@ -459,7 +500,7 @@ class RuleControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\RuleController::update+ * @covers \FireflyIII\Http\Controllers\RuleController* @covers \FireflyIII\Http\Requests\RuleFormRequest*/public function testUpdate(): voiddiff --git a/tests/Feature/Controllers/TransactionControllerTest.php b/tests/Feature/Controllers/TransactionControllerTest.phpindex 2f95316af3..db10f10d27 100644--- a/tests/Feature/Controllers/TransactionControllerTest.php+++ b/tests/Feature/Controllers/TransactionControllerTest.php@@ -54,10 +54,10 @@ class TransactionControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\TransactionController::index- * @covers \FireflyIII\Http\Controllers\TransactionController::__construct- * @covers \FireflyIII\Http\Controllers\TransactionController::getPeriodOverview- * @covers \FireflyIII\Http\Controllers\TransactionController::sumPerCurrency+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testIndex(): void{@@ -91,7 +91,7 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::index+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testIndexAll(): void{@@ -125,9 +125,9 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::index- * @covers \FireflyIII\Http\Controllers\TransactionController::getPeriodOverview- * @covers \FireflyIII\Http\Controllers\TransactionController::sumPerCurrency+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testIndexByDate(): void{@@ -168,10 +168,53 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::index- * @covers \FireflyIII\Http\Controllers\TransactionController::__construct- * @covers \FireflyIII\Http\Controllers\TransactionController::getPeriodOverview- * @covers \FireflyIII\Http\Controllers\TransactionController::sumPerCurrency+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ */+ public function testIndexByDateReversed(): void+ {+ $transaction = new Transaction;+ $transaction->transaction_currency_id = 1;+ $transaction->transaction_currency_symbol = 'x';+ $transaction->transaction_currency_code = 'ABC';+ $transaction->transaction_currency_dp = 2;+ $transaction->transaction_amount = '5';+ $collection = new Collection([$transaction]);+++ // mock stuff+ $repository = $this->mock(JournalRepositoryInterface::class);+ $collector = $this->mock(JournalCollectorInterface::class);+ $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();+ $repository->shouldReceive('firstNull')->once()->andReturn($transfer);+ $repository->shouldReceive('firstNull')->once()->andReturn($transfer);++ $collector->shouldReceive('setTypes')->andReturnSelf();+ $collector->shouldReceive('setLimit')->andReturnSelf();+ $collector->shouldReceive('setPage')->andReturnSelf();+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();+ $collector->shouldReceive('addFilter')->andReturnSelf();+ $collector->shouldReceive('setRange')->andReturnSelf();+ $collector->shouldReceive('withBudgetInformation')->andReturnSelf();+ $collector->shouldReceive('withCategoryInformation')->andReturnSelf();+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();+ $collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();+ $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));+ $collector->shouldReceive('getJournals')->andReturn($collection);++ $this->be($this->user());+ $response = $this->get(route('transactions.index', ['transfer', '2016-01-01','2015-12-31']));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testIndexDeposit(): void{@@ -211,10 +254,10 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::index- * @covers \FireflyIII\Http\Controllers\TransactionController::__construct- * @covers \FireflyIII\Http\Controllers\TransactionController::getPeriodOverview- * @covers \FireflyIII\Http\Controllers\TransactionController::sumPerCurrency+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testIndexWithdrawal(): void{@@ -254,7 +297,7 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::reconcile+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testReconcile(): void{@@ -271,7 +314,7 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::reorder+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testReorder(): void{@@ -293,8 +336,8 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\TransactionController::show- * @covers \FireflyIII\Http\Controllers\Controller::isOpeningBalance+ * @covers \FireflyIII\Http\Controllers\TransactionController+ * @covers \FireflyIII\Http\Controllers\Controller*/public function testShow(): void{@@ -316,8 +359,8 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Controller::redirectToAccount- * @covers \FireflyIII\Http\Controllers\TransactionController::show+ * @covers \FireflyIII\Http\Controllers\Controller+ * @covers \FireflyIII\Http\Controllers\TransactionController*/public function testShowOpeningBalance(): void{