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\Support\Facades\FireflyConfig;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ConfigurationController.
|
||||
|
@ -73,7 +73,7 @@ class ConvertToTransfer implements ActionInterface
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($journal->user);
|
||||
$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) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
@ -74,7 +74,7 @@ class VersionCheckEventHandlerTest extends TestCase
|
||||
|
||||
// request thing:
|
||||
$request->shouldReceive('call')->once()->andThrow(new FireflyException('Errrr'));
|
||||
$request->shouldReceive('getReleases')->once();
|
||||
$request->shouldNotReceive('getReleases');
|
||||
|
||||
|
||||
$handler = new VersionCheckEventHandler;
|
||||
|
@ -125,7 +125,6 @@ class ImportArrayStorageTest extends TestCase
|
||||
$transactions = [$this->singleTransfer(), $this->singleWithdrawal(), $this->basedOnTransfer($transfer)];
|
||||
$job->save();
|
||||
|
||||
|
||||
// get some stuff:
|
||||
$tag = $this->user()->tags()->inRandomOrder()->first();
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
@ -141,9 +140,9 @@ class ImportArrayStorageTest extends TestCase
|
||||
$ruleRepos = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('getTransactions')->times(2)->andReturn($transactions);
|
||||
|
||||
// mock calls:
|
||||
$collector->shouldReceive('setUser')->times(2);
|
||||
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('setStatus')->withAnyArgs();
|
||||
$ruleRepos->shouldReceive('setUser')->once();
|
||||
@ -554,7 +553,7 @@ class ImportArrayStorageTest extends TestCase
|
||||
return
|
||||
[
|
||||
'type' => 'transfer',
|
||||
'date' => $transfer->date->format('Y-m-d'),
|
||||
'date' => $transfer->date->format('Y-m-d H:i:s'),
|
||||
'tags' => '',
|
||||
'user' => $this->user()->id,
|
||||
|
||||
|
@ -472,7 +472,7 @@ class ChooseAccountsHandlerTest extends TestCase
|
||||
$usd = TransactionCurrency::where('code', 'USD')->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();
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]])
|
||||
->once()->andReturn(new Collection([$first, $second]));
|
||||
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
||||
->andReturn(1, 2);
|
||||
@ -625,7 +625,7 @@ class ChooseAccountsHandlerTest extends TestCase
|
||||
$usd = TransactionCurrency::where('code', 'USD')->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();
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]])
|
||||
->once()->andReturn(new Collection([$first, $second]));
|
||||
$accountRepos->shouldReceive('getMetaValue')->twice()->withArgs([Mockery::any(), 'currency_id'])
|
||||
->andReturn(1, 2);
|
||||
|
@ -65,7 +65,7 @@ class ConvertToTransferTest extends TestCase
|
||||
// mock used stuff:
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$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:
|
||||
$ruleAction = new RuleAction;
|
||||
@ -100,7 +100,7 @@ class ConvertToTransferTest extends TestCase
|
||||
// mock used stuff:
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$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:
|
||||
$ruleAction = new RuleAction;
|
||||
|
Loading…
Reference in New Issue
Block a user