Merge pull request #2302 from CihanSenturk/master
Account show page test added
This commit is contained in:
commit
4fb828d88b
@ -37,7 +37,7 @@ class Accounts extends Controller
|
|||||||
// Handle transactions
|
// Handle transactions
|
||||||
$transactions = Transaction::with('account', 'category')->where('account_id', $account->id)->collect('paid_at');
|
$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) {
|
if ($transfer->expense_account->id == $account->id || $transfer->income_account->id == $account->id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,18 @@ class AccountsTest extends FeatureTestCase
|
|||||||
$this->assertSoftDeleted('accounts', $request);
|
$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()
|
public function getRequest()
|
||||||
{
|
{
|
||||||
return Account::factory()->enabled()->raw();
|
return Account::factory()->enabled()->raw();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user