From ce923d295b58c368ae0da8e11bdd15b72b780f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:03:32 +0300 Subject: [PATCH 1/3] Account show test added --- tests/Feature/Banking/AccountsTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Feature/Banking/AccountsTest.php b/tests/Feature/Banking/AccountsTest.php index 5469d63f5..2a5a8d203 100644 --- a/tests/Feature/Banking/AccountsTest.php +++ b/tests/Feature/Banking/AccountsTest.php @@ -82,6 +82,18 @@ class AccountsTest extends FeatureTestCase $this->assertSoftDeleted('accounts', $request); } + public function testItShouldShowAccount() + { + $request = $this->getRequest(); + + $account = $this->dispatch(new CreateAccount($request)); + + $this->loginAs() + ->get(route('accounts.show', $account->id)) + ->assertStatus(200) + ->assertSee($account->name); + } + public function getRequest() { return Account::factory()->enabled()->raw(); From 32fc5793073b24e226733f63f7ef18834335ae70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:05:40 +0300 Subject: [PATCH 2/3] Account show page fix typo --- app/Http/Controllers/Banking/Accounts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php index 6b8c66ab1..5f3ac377d 100644 --- a/app/Http/Controllers/Banking/Accounts.php +++ b/app/Http/Controllers/Banking/Accounts.php @@ -37,7 +37,7 @@ class Accounts extends Controller // Handle transactions $transactions = Transaction::with('account', 'category')->where('account_id', $account->id)->collect('paid_at'); - $transfers = Transfer::with('transaction')->all()->filter(function ($transfer) use($account) { + $transfers = Transfer::with('transaction')->cursor()->filter(function ($transfer) use($account) { if ($transfer->expense_account->id == $account->id || $transfer->income_account->id == $account->id) { return true; } From d7969873ec83ae11a42ce9ecaa3bfc65260c5984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:58:21 +0300 Subject: [PATCH 3/3] fix typo --- app/Http/Controllers/Banking/Accounts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php index 5f3ac377d..1d48ef5e3 100644 --- a/app/Http/Controllers/Banking/Accounts.php +++ b/app/Http/Controllers/Banking/Accounts.php @@ -37,7 +37,7 @@ class Accounts extends Controller // Handle transactions $transactions = Transaction::with('account', 'category')->where('account_id', $account->id)->collect('paid_at'); - $transfers = Transfer::with('transaction')->cursor()->filter(function ($transfer) use($account) { + $transfers = Transfer::with('expense_transaction', 'income_transaction')->get()->filter(function ($transfer) use($account) { if ($transfer->expense_account->id == $account->id || $transfer->income_account->id == $account->id) { return true; }