Cleanup expected and unexpected bugs in the factories.

This commit is contained in:
James Cole
2019-06-16 13:15:32 +02:00
parent 4a1e56671b
commit 23d7abd55f
16 changed files with 173 additions and 160 deletions

View File

@@ -30,6 +30,7 @@ use FireflyIII\User;
/**
* Class TransactionGroupFactory
* @codeCoverageIgnore
*/
class TransactionGroupFactory
{
@@ -59,12 +60,12 @@ class TransactionGroupFactory
$this->journalFactory->setUser($this->user);
$collection = $this->journalFactory->create($data);
$title = $data['group_title'] ?? null;
$title = $title === '' ? null : $title;
$title = '' === $title ? null : $title;
/** @var TransactionJournal $first */
$first = $collection->first();
$group = new TransactionGroup;
$group->user()->associate($first->user);
$group->title = $title ?? $first->description;
$group->title = $title;
$group->save();
$group->transactionJournals()->saveMany($collection);