Fix the unit tests.

This commit is contained in:
James Cole
2017-08-18 15:32:11 +02:00
parent 7d8876f03c
commit 9b17715175
8 changed files with 101 additions and 70 deletions

View File

@@ -71,6 +71,7 @@ class UpgradeDatabase extends Command
$this->setTransactionIdentifier();
$this->migrateRepetitions();
$this->updateAccountCurrencies();
$this->line('Updating currency information..');
$this->updateTransferCurrencies();
$this->updateOtherCurrencies();
$this->info('Firefly III database is up to date.');
@@ -218,16 +219,10 @@ class UpgradeDatabase extends Command
if (is_null($transaction->transaction_currency_id)) {
$transaction->transaction_currency_id = $currency->id;
$transaction->save();
$this->line(sprintf('Transaction #%d is set to %s', $transaction->id, $currency->code));
}
// when mismatch in transaction:
if ($transaction->transaction_currency_id !== $currency->id) {
$this->line(
sprintf(
'Transaction #%d is set to %s and foreign %s', $transaction->id, $currency->code, $transaction->transactionCurrency->code
)
);
$transaction->foreign_currency_id = $transaction->transaction_currency_id;
$transaction->foreign_amount = $transaction->amount;
$transaction->transaction_currency_id = $currency->id;
@@ -372,12 +367,10 @@ class UpgradeDatabase extends Command
if (is_null($transaction->transaction_currency_id)) {
$transaction->transaction_currency_id = $currency->id;
$transaction->save();
$this->line(sprintf('Transaction #%d is set to %s', $transaction->id, $currency->code));
}
// when mismatch in transaction:
if ($transaction->transaction_currency_id !== $currency->id) {
$this->line(sprintf('Transaction #%d is set to %s and foreign %s', $transaction->id, $currency->code, $transaction->transactionCurrency->code));
$transaction->foreign_currency_id = $transaction->transaction_currency_id;
$transaction->foreign_amount = $transaction->amount;
$transaction->transaction_currency_id = $currency->id;

View File

@@ -152,12 +152,9 @@ class ExportController extends Controller
$jobs->changeStatus($job, 'export_status_make_exporter');
/** @var ProcessorInterface $processor */
$processor = app(ExpandedProcessor::class);
$processor = app(ProcessorInterface::class);
$processor->setSettings($settings);
/*
* Collect journals:
*/

View File

@@ -13,12 +13,15 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class ExportJob
*
* @property User $user
*
* @package FireflyIII\Models
*/
class ExportJob extends Model

View File

@@ -13,7 +13,7 @@ declare(strict_types=1);
namespace FireflyIII\Providers;
use FireflyIII\Export\Processor;
use FireflyIII\Export\ExpandedProcessor;
use FireflyIII\Export\ProcessorInterface;
use FireflyIII\Generator\Chart\Basic\ChartJsGenerator;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
@@ -138,7 +138,8 @@ class FireflyServiceProvider extends ServiceProvider
);
// other generators
$this->app->bind(ProcessorInterface::class, Processor::class);
// export:
$this->app->bind(ProcessorInterface::class, ExpandedProcessor::class);
$this->app->bind(UserRepositoryInterface::class, UserRepository::class);
$this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class);