mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Expand tests.
This commit is contained in:
@@ -32,7 +32,6 @@ use Illuminate\Validation\Validator;
|
||||
|
||||
|
||||
/**
|
||||
* todo cannot submit using currency not part of source / dest
|
||||
* Class TransactionRequest
|
||||
*/
|
||||
class TransactionRequest extends Request
|
||||
@@ -146,9 +145,6 @@ class TransactionRequest extends Request
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
|
||||
// todo tags
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -45,12 +45,13 @@ class PiggyBankEventFactory
|
||||
*/
|
||||
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): ?PiggyBankEvent
|
||||
{
|
||||
Log::debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
|
||||
if (is_null($piggyBank)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// is a transfer?
|
||||
if (!TransactionType::TRANSFER === $journal->transactionType->type) {
|
||||
if (!(TransactionType::TRANSFER === $journal->transactionType->type)) {
|
||||
Log::info(sprintf('Will not connect %s #%d to a piggy bank.', $journal->transactionType->type, $journal->id));
|
||||
|
||||
return null;
|
||||
|
@@ -78,9 +78,10 @@ class TransactionJournalFactory
|
||||
// link bill:
|
||||
$this->connectBill($journal, $data);
|
||||
|
||||
// link piggy bank:
|
||||
// link piggy bank (if transfer)
|
||||
$this->connectPiggyBank($journal, $data);
|
||||
|
||||
|
||||
// link tags:
|
||||
$this->connectTags($journal, $data);
|
||||
|
||||
|
@@ -339,6 +339,10 @@ class SingleController extends Controller
|
||||
$doSplit = 1 === intval($request->get('split_journal'));
|
||||
$createAnother = 1 === intval($request->get('create_another'));
|
||||
$data = $request->getJournalData();
|
||||
|
||||
// todo call factory instead of repository
|
||||
|
||||
|
||||
$journal = $repository->store($data);
|
||||
if (null === $journal->id) {
|
||||
// error!
|
||||
|
Reference in New Issue
Block a user