Merge pull request #2302 from CihanSenturk/master

Account show page test added
This commit is contained in:
Cüneyt Şentürk 2021-11-10 15:11:59 +03:00 committed by GitHub
commit 4fb828d88b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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('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;
}

View File

@ -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();