mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-11 17:39:41 +00:00
New unit tests.
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\TransactionRules\Actions;
|
||||
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Log;
|
||||
@@ -45,8 +46,11 @@ class ClearNotes implements ActionInterface
|
||||
public function act(TransactionJournal $journal): bool
|
||||
{
|
||||
Log::debug(sprintf('RuleAction ClearNotes removed all notes.'));
|
||||
$journal->deleteMeta('notes');
|
||||
$journal->save();
|
||||
$notes = $journal->notes()->get();
|
||||
/** @var Note $note */
|
||||
foreach ($notes as $note) {
|
||||
$note->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ class SetDescription implements ActionInterface
|
||||
*/
|
||||
public function act(TransactionJournal $journal): bool
|
||||
{
|
||||
$oldDescription = $journal->description;
|
||||
|
||||
$oldDescription = $journal->description;
|
||||
$journal->description = $this->action->action_value;
|
||||
$journal->save();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class SetDestinationAccount implements ActionInterface
|
||||
if ($count > 2) {
|
||||
Log::error(sprintf('Cannot change destination account of journal #%d because it is a split journal.', $journal->id));
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// journal type:
|
||||
@@ -81,7 +81,7 @@ class SetDestinationAccount implements ActionInterface
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if this is a withdrawal, the new destination account must be a expense account and may be created:
|
||||
|
||||
@@ -66,7 +66,7 @@ class SetSourceAccount implements ActionInterface
|
||||
if ($count > 2) {
|
||||
Log::error(sprintf('Cannot change source account of journal #%d because it is a split journal.', $journal->id));
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// journal type:
|
||||
@@ -80,7 +80,7 @@ class SetSourceAccount implements ActionInterface
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if this is a deposit, the new source account must be a revenue account and may be created:
|
||||
|
||||
Reference in New Issue
Block a user