Small adjustments to fix tests.

This commit is contained in:
James Cole
2018-02-23 16:21:28 +01:00
parent d804093f8b
commit 6591fa9fb4
13 changed files with 192 additions and 41 deletions

View File

@@ -150,23 +150,22 @@ class BulkController extends Controller
foreach ($journalIds as $journalId) {
$journal = $repository->find(intval($journalId));
if (!is_null($journal)) {
// TODO need to move this to update service.
$count++;
Log::debug(sprintf('Found journal #%d', $journal->id));
// update category if not told to ignore
if ($ignoreCategory === false) {
Log::debug(sprintf('Set category to %s', $request->string('category')));
$service->updateCategory($journal, $request->string('category'));
$repository->updateCategory($journal, $request->string('category'));
}
// update budget if not told to ignore (and is withdrawal)
if ($ignoreBudget === false) {
Log::debug(sprintf('Set budget to %d', $request->integer('budget_id')));
$service->updateBudget($journal, $request->integer('budget_id'));
$repository->updateBudget($journal, $request->integer('budget_id'));
}
if ($ignoreTags === false) {
Log::debug(sprintf('Set tags to %s', $request->string('budget_id')));
$service->updateTags($journal, explode(',', $request->string('tags')));
$repository->updateTags($journal, explode(',', $request->string('tags')));
}
// update tags if not told to ignore (and is withdrawal)
}

View File

@@ -26,7 +26,6 @@ use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Events\StoredTransactionJournal;
use FireflyIII\Events\UpdatedTransactionJournal;
use FireflyIII\Factory\TransactionJournalFactory;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\JournalFormRequest;
@@ -366,13 +365,7 @@ class SingleController extends Controller
'foreign_amount' => null,
],
];
var_dump($data);exit;
// todo call factory instead of repository
/** @var TransactionJournalFactory $factory */
$factory = app(TransactionJournalFactory::class);
$factory->setUser(auth()->user());
$journal = $factory->create($data);
//$journal = $repository->store($data);
$journal = $repository->store($data);
if (null === $journal->id) {
// error!
Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray());