mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Fix tests that selected split journals.
This commit is contained in:
@@ -50,7 +50,16 @@ class SetDestinationAccountTest extends TestCase
|
|||||||
{
|
{
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||||
$journal = TransactionJournal::where('transaction_type_id', $type->id)->first();
|
|
||||||
|
// select split transactions to exclude them later:
|
||||||
|
$set = TransactionJournal::where('transaction_type_id', $type->id)->get(['transaction_journals.*']);
|
||||||
|
foreach ($set as $current) {
|
||||||
|
if ($current->transactions()->count() === 2) {
|
||||||
|
$journal = $current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$destinationTr = $journal->transactions()->where('amount', '>', 0)->first();
|
$destinationTr = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
$destination = $destinationTr->account;
|
$destination = $destinationTr->account;
|
||||||
$user = $journal->user;
|
$user = $journal->user;
|
||||||
@@ -88,7 +97,17 @@ class SetDestinationAccountTest extends TestCase
|
|||||||
{
|
{
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||||
$journal = TransactionJournal::where('transaction_type_id', $type->id)->first();
|
|
||||||
|
// select split transactions to exclude them later:
|
||||||
|
$set = TransactionJournal::where('transaction_type_id', $type->id)->get(['transaction_journals.*']);
|
||||||
|
foreach ($set as $current) {
|
||||||
|
if ($current->transactions()->count() === 2) {
|
||||||
|
$journal = $current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$destinationTr = $journal->transactions()->where('amount', '>', 0)->first();
|
$destinationTr = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
$destination = $destinationTr->account;
|
$destination = $destinationTr->account;
|
||||||
$user = $journal->user;
|
$user = $journal->user;
|
||||||
|
@@ -50,7 +50,16 @@ class SetSourceAccountTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
$type = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||||
$journal = TransactionJournal::where('transaction_type_id', $type->id)->first();
|
|
||||||
|
// select split transactions to exclude them later:
|
||||||
|
$set = TransactionJournal::where('transaction_type_id', $type->id)->get(['transaction_journals.*']);
|
||||||
|
foreach ($set as $current) {
|
||||||
|
if ($current->transactions()->count() === 2) {
|
||||||
|
$journal = $current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sourceTr = $journal->transactions()->where('amount', '<', 0)->first();
|
$sourceTr = $journal->transactions()->where('amount', '<', 0)->first();
|
||||||
$source = $sourceTr->account;
|
$source = $sourceTr->account;
|
||||||
$user = $journal->user;
|
$user = $journal->user;
|
||||||
@@ -88,7 +97,16 @@ class SetSourceAccountTest extends TestCase
|
|||||||
{
|
{
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
$type = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||||
$journal = TransactionJournal::where('transaction_type_id', $type->id)->first();
|
|
||||||
|
// select split transactions to exclude them later:
|
||||||
|
$set = TransactionJournal::where('transaction_type_id', $type->id)->get(['transaction_journals.*']);
|
||||||
|
foreach ($set as $current) {
|
||||||
|
if ($current->transactions()->count() === 2) {
|
||||||
|
$journal = $current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sourceTr = $journal->transactions()->where('amount', '<', 0)->first();
|
$sourceTr = $journal->transactions()->where('amount', '<', 0)->first();
|
||||||
$source = $sourceTr->account;
|
$source = $sourceTr->account;
|
||||||
$user = $journal->user;
|
$user = $journal->user;
|
||||||
|
Reference in New Issue
Block a user