diff --git a/tests/Feature/Controllers/BillControllerTest.php b/tests/Feature/Controllers/BillControllerTest.php index 94c48b9dab..9aa46bb6d2 100644 --- a/tests/Feature/Controllers/BillControllerTest.php +++ b/tests/Feature/Controllers/BillControllerTest.php @@ -164,16 +164,16 @@ class BillControllerTest extends TestCase $repository = $this->mock(BillRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class); $transformer = $this->mock(BillTransformer::class); - $euro = $this->getEuro(); - $pref = new Preference; - $pref->data = 50; + $euro = $this->getEuro(); + $pref = new Preference; + $pref->data = 50; Preferences::shouldReceive('get')->withArgs(['listPageSize', 50])->atLeast()->once()->andReturn($pref); Amount::shouldReceive('formatAnything')->andReturn('-100'); $transformer->shouldReceive('setParameters')->atLeast()->once(); $transformer->shouldReceive('transform')->atLeast()->once()->andReturn( - ['id' => 5, 'active' => true, 'name' => 'x', 'next_expected_match' => '2018-01-01', - 'currency' => $this->getEuro(), + ['id' => 5, 'active' => true, 'name' => 'x', 'next_expected_match' => '2018-01-01', + 'currency' => $this->getEuro(), 'currency_id' => $euro->id, 'currency_code' => $euro->code, 'currency_symbol' => $euro->symbol, diff --git a/tests/Feature/Controllers/Json/ReconcileControllerTest.php b/tests/Feature/Controllers/Json/ReconcileControllerTest.php index 37d658ac77..0f819d808c 100644 --- a/tests/Feature/Controllers/Json/ReconcileControllerTest.php +++ b/tests/Feature/Controllers/Json/ReconcileControllerTest.php @@ -121,7 +121,7 @@ class ReconcileControllerTest extends TestCase $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date); - $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1')->atLeast()->once(); + //$accountRepos->shouldReceive('getAccountCurrency')->atLeast()->once()->andReturn($euro); $collector->shouldReceive('setAccounts')->atLeast()->once()->andReturnSelf(); diff --git a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php index 20bc586cda..3bdd9b0198 100644 --- a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php +++ b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php @@ -144,8 +144,7 @@ class ImportableConverterTest extends TestCase $currencyMapper = $this->mock(CurrencyMapper::class); $accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos->shouldReceive('setUser')->once(); - $accountRepos->shouldReceive('getMetaValue') - ->withArgs([Mockery::any(), 'currency_id'])->atLeast()->once()->andReturn('1'); + $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->atLeast()->once()->andReturn('1'); // get default currency $euro = TransactionCurrency::whereCode('EUR')->first(); @@ -162,12 +161,12 @@ class ImportableConverterTest extends TestCase $asset = $this->user()->accounts()->where('account_type_id', 3)->first(); $other = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $asset->id)->first(); - $assetMapper->shouldReceive('map')->once()->withArgs([null, $nullAccount])->andReturn($asset); - $opposingMapper->shouldReceive('map')->once()->withArgs([null, '45.67', $nullAccount])->andReturn($other); + $assetMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, $nullAccount])->andReturn($asset); + $opposingMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, '45.67', $nullAccount])->andReturn($other); - $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn(null); - $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['code' => null]])->andReturn(null); - $currencyMapper->shouldReceive('map')->times(2)->withArgs([$euro->id, []])->andReturn($euro); + $currencyMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn(null); + $currencyMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, ['code' => null]])->andReturn(null); + $currencyMapper->shouldReceive('map')->atLeast()->once()->withArgs([$euro->id, []])->andReturn($euro); $converter = new ImportableConverter; @@ -226,8 +225,8 @@ class ImportableConverterTest extends TestCase $asset = $this->user()->accounts()->where('account_type_id', 3)->first(); $revenue = $this->user()->accounts()->where('account_type_id', 5)->first(); - $assetMapper->shouldReceive('map')->once()->withArgs([null, $nullAccount])->andReturn($asset); - $opposingMapper->shouldReceive('map')->once()->withArgs([null, '45.67', $nullAccount])->andReturn($revenue); + $assetMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, $nullAccount])->andReturn($asset); + $opposingMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, '45.67', $nullAccount])->andReturn($revenue); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn($usd); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['code' => null]])->andReturn(null); @@ -289,8 +288,8 @@ class ImportableConverterTest extends TestCase // respond to mapping call: $asset = $this->user()->accounts()->where('account_type_id', 3)->first(); - $assetMapper->shouldReceive('map')->once()->withArgs([null, $nullAccount])->andReturn($asset); - $opposingMapper->shouldReceive('map')->once()->withArgs([null, '-45.67', $nullAccount])->andReturn($asset); + $assetMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, $nullAccount])->andReturn($asset); + $opposingMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, '-45.67', $nullAccount])->andReturn($asset); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn($usd); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['code' => null]])->andReturn(null); $repository->shouldReceive('addErrorMessage')->withArgs( @@ -349,8 +348,8 @@ class ImportableConverterTest extends TestCase $asset = $this->user()->accounts()->where('account_type_id', 3)->first(); $other = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $asset->id)->first(); - $assetMapper->shouldReceive('map')->once()->withArgs([null, $nullAccount])->andReturn($asset); - $opposingMapper->shouldReceive('map')->once()->withArgs([null, '45.67', $nullAccount])->andReturn($other); + $assetMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, $nullAccount])->andReturn($asset); + $opposingMapper->shouldReceive('map')->atLeast()->once()->withArgs([null, '45.67', $nullAccount])->andReturn($other); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn($usd); $currencyMapper->shouldReceive('map')->once()->withArgs([null, ['code' => null]])->andReturn(null);