mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 16:13:54 +00:00
use cases for rules tested.
This commit is contained in:
@@ -102,6 +102,9 @@ class SetDestinationAccount implements ActionInterface
|
|||||||
// update destination transaction with new destination account:
|
// update destination transaction with new destination account:
|
||||||
// get destination transaction:
|
// get destination transaction:
|
||||||
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
|
if(null === $transaction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
$transaction->account_id = $this->newDestinationAccount->id;
|
$transaction->account_id = $this->newDestinationAccount->id;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
$journal->touch();
|
$journal->touch();
|
||||||
@@ -131,7 +134,7 @@ class SetDestinationAccount implements ActionInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function findExpenseAccount()
|
private function findExpenseAccount(): void
|
||||||
{
|
{
|
||||||
$account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]);
|
$account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]);
|
||||||
if (null === $account) {
|
if (null === $account) {
|
||||||
|
@@ -92,6 +92,20 @@ class TransactionCurrencyFactoryTest extends TestCase
|
|||||||
$this->assertEquals($currency->id, $result->id);
|
$this->assertEquals($currency->id, $result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* submit ID = 1000
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Factory\TransactionCurrencyFactory
|
||||||
|
*/
|
||||||
|
public function testFindByBadID(): void
|
||||||
|
{
|
||||||
|
$currency = TransactionCurrency::inRandomOrder()->whereNull('deleted_at')->first();
|
||||||
|
/** @var TransactionCurrencyFactory $factory */
|
||||||
|
$factory = app(TransactionCurrencyFactory::class);
|
||||||
|
$result = $factory->find(1000, $currency->code);
|
||||||
|
$this->assertEquals($currency->id, $result->id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Factory\TransactionCurrencyFactory
|
* @covers \FireflyIII\Factory\TransactionCurrencyFactory
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user