diff --git a/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php b/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php index 6d21d3ea2f..2ccd0c305b 100644 --- a/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php +++ b/tests/Unit/Console/Commands/Tools/ApplyRulesTest.php @@ -154,17 +154,6 @@ class ApplyRulesTest extends TestCase $ruleGroupRepos->shouldReceive('getActiveGroups')->atLeast()->once()->andReturn($groups); $ruleGroupRepos->shouldReceive('getActiveStoreRules')->atLeast()->once()->andReturn(new Collection); - - $collector->shouldReceive('setUser')->atLeast()->once()->andReturnSelf(); - $collector->shouldReceive('setAccounts')->atLeast()->once()->andReturnSelf(); - $collector->shouldReceive('setRange')->atLeast()->once()->andReturnSelf(); - $collector->shouldReceive('getExtractedJournals')->atLeast()->once()->andReturn([[], [], []]); - - $ruleEngine->shouldReceive('setUser')->atLeast()->once(); - $ruleEngine->shouldReceive('setRulesToApply')->atLeast()->once(); - $ruleEngine->shouldReceive('processJournalArray')->times(3); - $ruleEngine->shouldReceive('setTriggerMode')->atLeast()->once()->withArgs([RuleEngine::TRIGGER_STORE]); - $parameters = [ '--user=1', '--token=token', @@ -179,8 +168,7 @@ class ApplyRulesTest extends TestCase $this->artisan('firefly-iii:apply-rules ' . implode(' ', $parameters)) ->expectsOutput('No rules or rule groups have been included.') - ->expectsOutput('Done!') - ->assertExitCode(0); + ->assertExitCode(1); } diff --git a/tests/Unit/Console/Commands/Upgrade/OtherCurrenciesCorrectionsTest.php b/tests/Unit/Console/Commands/Upgrade/OtherCurrenciesCorrectionsTest.php index 07705354d8..041629d954 100644 --- a/tests/Unit/Console/Commands/Upgrade/OtherCurrenciesCorrectionsTest.php +++ b/tests/Unit/Console/Commands/Upgrade/OtherCurrenciesCorrectionsTest.php @@ -81,13 +81,14 @@ class OtherCurrenciesCorrectionsTest extends TestCase // account repos $accountRepos->shouldReceive('setUser')->atLeast()->once(); - $accountRepos->shouldReceive('getMetaValue')->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); + #$accountRepos->shouldReceive('getMetaValue')->atLeast()->once() + # ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); // collect currency $currencyRepos->shouldReceive('setUser')->atLeast()->once(); - $currencyRepos->shouldReceive('findNull')->atLeast()->once() - ->withArgs([1])->andReturn($euro); + #$currencyRepos->shouldReceive('findNull')->atLeast()->once() + # ->withArgs([1])->andReturn($euro); // configuration $false = new Configuration; @@ -157,13 +158,12 @@ class OtherCurrenciesCorrectionsTest extends TestCase // account repos $accountRepos->shouldReceive('setUser')->atLeast()->once(); - $accountRepos->shouldReceive('getMetaValue')->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); // collect currency $currencyRepos->shouldReceive('setUser')->atLeast()->once(); - $currencyRepos->shouldReceive('findNull')->atLeast()->once() - ->withArgs([1])->andReturn($euro); + #$currencyRepos->shouldReceive('findNull')->atLeast()->once() + # ->withArgs([1])->andReturn($euro); // configuration $false = new Configuration; @@ -242,13 +242,13 @@ class OtherCurrenciesCorrectionsTest extends TestCase // account repos $accountRepos->shouldReceive('setUser')->atLeast()->once(); - $accountRepos->shouldReceive('getMetaValue')->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); - + #$accountRepos->shouldReceive('getMetaValue')->atLeast()->once() + # ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); // collect currency $currencyRepos->shouldReceive('setUser')->atLeast()->once(); - $currencyRepos->shouldReceive('findNull')->atLeast()->once() - ->withArgs([1])->andReturn($euro); + #$currencyRepos->shouldReceive('findNull')->atLeast()->once() + # ->withArgs([1])->andReturn($euro); // configuration $false = new Configuration; diff --git a/tests/Unit/Console/Commands/Upgrade/TransferCurrenciesCorrectionsTest.php b/tests/Unit/Console/Commands/Upgrade/TransferCurrenciesCorrectionsTest.php index bbfbbb04cf..3c91008685 100644 --- a/tests/Unit/Console/Commands/Upgrade/TransferCurrenciesCorrectionsTest.php +++ b/tests/Unit/Console/Commands/Upgrade/TransferCurrenciesCorrectionsTest.php @@ -106,14 +106,15 @@ class TransferCurrenciesCorrectionsTest extends TestCase ->atLeast()->once()->andReturn(new Collection([$transfer])); // account repos - $accountRepos->shouldReceive('getMetaValue') - ->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + #$accountRepos->shouldReceive('getMetaValue') + # ->atLeast()->once() + # ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); // currency repos - $currencyRepos->shouldReceive('findNull') - ->atLeast()->once() - ->withArgs([1])->andReturn($euro); + #$currencyRepos->shouldReceive('findNull') + # ->atLeast()->once() + # ->withArgs([1])->andReturn($euro); // configuration $false = new Configuration; @@ -151,14 +152,15 @@ class TransferCurrenciesCorrectionsTest extends TestCase ->atLeast()->once()->andReturn(new Collection([$transfer])); // account repos - $accountRepos->shouldReceive('getMetaValue') - ->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + #$accountRepos->shouldReceive('getMetaValue') + # ->atLeast()->once() + # ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); // currency repos - $currencyRepos->shouldReceive('findNull') - ->atLeast()->once() - ->withArgs([1])->andReturn($euro); + #$currencyRepos->shouldReceive('findNull') + # ->atLeast()->once() + # ->withArgs([1])->andReturn($euro); // configuration $false = new Configuration; @@ -202,16 +204,7 @@ class TransferCurrenciesCorrectionsTest extends TestCase ->withArgs([[TransactionType::TRANSFER]]) ->atLeast()->once()->andReturn(new Collection([$transfer])); - // account repos - $accountRepos->shouldReceive('getMetaValue') - ->atLeast()->once() - ->withArgs([Mockery::any(), 'currency_id'])->andReturn('1', $dollar->id); - - // currency repos - $currencyRepos->shouldReceive('findNull') - ->atLeast()->once() - ->withArgs([1])->andReturn($euro); - + $accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); $currencyRepos->shouldReceive('findNull') ->atLeast()->once() ->withArgs([$dollar->id])->andReturn($dollar);