mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix tests
This commit is contained in:
parent
4c94820cf4
commit
71104f375c
@ -29,6 +29,7 @@ use FireflyIII\Http\Middleware\IsSandStormUser;
|
|||||||
use FireflyIII\Http\Requests\ConfigurationRequest;
|
use FireflyIII\Http\Requests\ConfigurationRequest;
|
||||||
use FireflyIII\Support\Facades\FireflyConfig;
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ConfigurationController.
|
* Class ConfigurationController.
|
||||||
|
@ -73,7 +73,7 @@ class ConvertToTransfer implements ActionInterface
|
|||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$repository->setUser($journal->user);
|
$repository->setUser($journal->user);
|
||||||
$asset = $repository->findByName(
|
$asset = $repository->findByName(
|
||||||
$this->action->action_value, [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
|
$this->action->action_value, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
|
||||||
);
|
);
|
||||||
if (null === $asset) {
|
if (null === $asset) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
|
@ -74,7 +74,7 @@ class VersionCheckEventHandlerTest extends TestCase
|
|||||||
|
|
||||||
// request thing:
|
// request thing:
|
||||||
$request->shouldReceive('call')->once()->andThrow(new FireflyException('Errrr'));
|
$request->shouldReceive('call')->once()->andThrow(new FireflyException('Errrr'));
|
||||||
$request->shouldReceive('getReleases')->once();
|
$request->shouldNotReceive('getReleases');
|
||||||
|
|
||||||
|
|
||||||
$handler = new VersionCheckEventHandler;
|
$handler = new VersionCheckEventHandler;
|
||||||
|
@ -125,7 +125,6 @@ class ImportArrayStorageTest extends TestCase
|
|||||||
$transactions = [$this->singleTransfer(), $this->singleWithdrawal(), $this->basedOnTransfer($transfer)];
|
$transactions = [$this->singleTransfer(), $this->singleWithdrawal(), $this->basedOnTransfer($transfer)];
|
||||||
$job->save();
|
$job->save();
|
||||||
|
|
||||||
|
|
||||||
// get some stuff:
|
// get some stuff:
|
||||||
$tag = $this->user()->tags()->inRandomOrder()->first();
|
$tag = $this->user()->tags()->inRandomOrder()->first();
|
||||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||||
@ -141,9 +140,9 @@ class ImportArrayStorageTest extends TestCase
|
|||||||
$ruleRepos = $this->mock(RuleRepositoryInterface::class);
|
$ruleRepos = $this->mock(RuleRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$repository->shouldReceive('getTransactions')->times(2)->andReturn($transactions);
|
$repository->shouldReceive('getTransactions')->times(2)->andReturn($transactions);
|
||||||
|
|
||||||
// mock calls:
|
// mock calls:
|
||||||
$collector->shouldReceive('setUser')->times(2);
|
$collector->shouldReceive('setUser')->times(2);
|
||||||
|
|
||||||
$repository->shouldReceive('setUser')->once();
|
$repository->shouldReceive('setUser')->once();
|
||||||
$repository->shouldReceive('setStatus')->withAnyArgs();
|
$repository->shouldReceive('setStatus')->withAnyArgs();
|
||||||
$ruleRepos->shouldReceive('setUser')->once();
|
$ruleRepos->shouldReceive('setUser')->once();
|
||||||
@ -554,7 +553,7 @@ class ImportArrayStorageTest extends TestCase
|
|||||||
return
|
return
|
||||||
[
|
[
|
||||||
'type' => 'transfer',
|
'type' => 'transfer',
|
||||||
'date' => $transfer->date->format('Y-m-d'),
|
'date' => $transfer->date->format('Y-m-d H:i:s'),
|
||||||
'tags' => '',
|
'tags' => '',
|
||||||
'user' => $this->user()->id,
|
'user' => $this->user()->id,
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ class ChooseAccountsHandlerTest extends TestCase
|
|||||||
$usd = TransactionCurrency::where('code', 'USD')->first();
|
$usd = TransactionCurrency::where('code', 'USD')->first();
|
||||||
$first = $this->user()->accounts()->where('account_type_id', 3)->first();
|
$first = $this->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
$second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $first->id)->first();
|
$second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $first->id)->first();
|
||||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])
|
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]])
|
||||||
->once()->andReturn(new Collection([$first, $second]));
|
->once()->andReturn(new Collection([$first, $second]));
|
||||||
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
||||||
->andReturn(1, 2);
|
->andReturn(1, 2);
|
||||||
@ -625,7 +625,7 @@ class ChooseAccountsHandlerTest extends TestCase
|
|||||||
$usd = TransactionCurrency::where('code', 'USD')->first();
|
$usd = TransactionCurrency::where('code', 'USD')->first();
|
||||||
$first = $this->user()->accounts()->where('account_type_id', 3)->first();
|
$first = $this->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
$second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $first->id)->first();
|
$second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $first->id)->first();
|
||||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])
|
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]])
|
||||||
->once()->andReturn(new Collection([$first, $second]));
|
->once()->andReturn(new Collection([$first, $second]));
|
||||||
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
||||||
->andReturn(1, 2);
|
->andReturn(1, 2);
|
||||||
|
@ -65,7 +65,7 @@ class ConvertToTransferTest extends TestCase
|
|||||||
// mock used stuff:
|
// mock used stuff:
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$accountRepos->shouldReceive('setUser')->once();
|
$accountRepos->shouldReceive('setUser')->once();
|
||||||
$accountRepos->shouldReceive('findByName')->withArgs([$asset->name, [AccountType::ASSET, AccountType::DEFAULT]])->andReturn($asset);
|
$accountRepos->shouldReceive('findByName')->withArgs([$asset->name, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]])->andReturn($asset);
|
||||||
|
|
||||||
// fire the action:
|
// fire the action:
|
||||||
$ruleAction = new RuleAction;
|
$ruleAction = new RuleAction;
|
||||||
@ -100,7 +100,7 @@ class ConvertToTransferTest extends TestCase
|
|||||||
// mock used stuff:
|
// mock used stuff:
|
||||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
$accountRepos->shouldReceive('setUser')->once();
|
$accountRepos->shouldReceive('setUser')->once();
|
||||||
$accountRepos->shouldReceive('findByName')->withArgs([$asset->name, [AccountType::ASSET, AccountType::DEFAULT]])->andReturn($asset);
|
$accountRepos->shouldReceive('findByName')->withArgs([$asset->name, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]])->andReturn($asset);
|
||||||
|
|
||||||
// fire the action:
|
// fire the action:
|
||||||
$ruleAction = new RuleAction;
|
$ruleAction = new RuleAction;
|
||||||
|
Loading…
Reference in New Issue
Block a user