diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php index 8c06e1e63c..26e3a5c5e0 100644 --- a/app/Factory/AccountFactory.php +++ b/app/Factory/AccountFactory.php @@ -194,7 +194,8 @@ class AccountFactory /** @var array $types */ $types = config('firefly.accountTypeByIdentifier.' . $accountType) ?? []; if (\count($types) > 0) { - $result = AccountType::whereIn('types', $types)->first(); + Log::debug(sprintf('%d accounts in list from config', \count($types)), $types); + $result = AccountType::whereIn('type', $types)->first(); } if (null === $result && null !== $accountType) { // try as full name: diff --git a/changelog.md b/changelog.md index 121443f5bf..e2ed3349f7 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +4.7.6 +- Only PHP7.2 as of the next release on October 1st. +- New liability feature. Does not do much yet. Tell me what you need while I develop: +-- transactions to / from +-- creation of liability: where is the money? move to asset? away? +-- what to do with interest? + + ## [4.7.5.3] - 2017-07-28 ### Added - Many updated French translations thanks to [@bubka](https://crowdin.com/profile/bubka). diff --git a/tests/Api/V1/Controllers/JournalLinkControllerTest.php b/tests/Api/V1/Controllers/JournalLinkControllerTest.php index 858f252c2f..069b9b5813 100644 --- a/tests/Api/V1/Controllers/JournalLinkControllerTest.php +++ b/tests/Api/V1/Controllers/JournalLinkControllerTest.php @@ -316,7 +316,7 @@ class JournalLinkControllerTest extends TestCase $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction])); $journalRepos->shouldReceive('findNull')->andReturn(null); - $repository->shouldReceive('updateLink')->once()->andReturn($journalLink); + //$repository->shouldReceive('updateLink')->once()->andReturn($journalLink); // data to submit $data = [ diff --git a/tests/Feature/Controllers/Account/EditControllerTest.php b/tests/Feature/Controllers/Account/EditControllerTest.php index 8e567f0527..2dd3cbcde3 100644 --- a/tests/Feature/Controllers/Account/EditControllerTest.php +++ b/tests/Feature/Controllers/Account/EditControllerTest.php @@ -25,6 +25,7 @@ namespace Tests\Feature\Controllers\Account; use Amount; +use FireflyIII\Models\AccountType; use FireflyIII\Models\Note; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; @@ -70,6 +71,15 @@ class EditControllerTest extends TestCase $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn(''); $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccMonthlyPaymentDate'])->andReturn(''); $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC'); + $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('1'); + $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly'); + + // get all types: + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Debt'])->andReturn(AccountType::find(11))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Loan'])->andReturn(AccountType::find(9))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Mortgage'])->andReturn(AccountType::find(12))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Credit card'])->andReturn(AccountType::find(13))->once(); + $this->be($this->user()); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); @@ -103,6 +113,14 @@ class EditControllerTest extends TestCase $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn(''); $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccMonthlyPaymentDate'])->andReturn(''); $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC'); + $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('1'); + $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly'); + + // get all types: + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Debt'])->andReturn(AccountType::find(11))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Loan'])->andReturn(AccountType::find(9))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Mortgage'])->andReturn(AccountType::find(12))->once(); + $accountRepos->shouldReceive('getAccountTypeByType')->withArgs(['Credit card'])->andReturn(AccountType::find(13))->once(); $this->be($this->user()); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); diff --git a/tests/Feature/Controllers/Account/IndexControllerTest.php b/tests/Feature/Controllers/Account/IndexControllerTest.php index f8aa6a9ae9..7dfc39e66f 100644 --- a/tests/Feature/Controllers/Account/IndexControllerTest.php +++ b/tests/Feature/Controllers/Account/IndexControllerTest.php @@ -74,6 +74,9 @@ class IndexControllerTest extends TestCase Steam::shouldReceive('balancesByAccounts')->andReturn([$account->id => '100']); Steam::shouldReceive('getLastActivities')->andReturn([]); + $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('1'); + $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('monthly'); + $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('123'); $this->be($this->user()); diff --git a/tests/Feature/Controllers/BillControllerTest.php b/tests/Feature/Controllers/BillControllerTest.php index 67a2468328..8a29efb42a 100644 --- a/tests/Feature/Controllers/BillControllerTest.php +++ b/tests/Feature/Controllers/BillControllerTest.php @@ -260,8 +260,7 @@ class BillControllerTest extends TestCase $repository->shouldReceive('store')->andReturn($bill); $attachHelper->shouldReceive('saveAttachmentsForModel'); $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag); - $ruleGroupRepos->shouldReceive('count')->andReturn(1); - $ruleGroupRepos->shouldReceive('getActiveGroups')->andReturn(new Collection([RuleGroup::first()]))->once(); + $data = [ 'name' => 'New Bill ' . random_int(1000, 9999), 'amount_min' => '100', @@ -296,8 +295,6 @@ class BillControllerTest extends TestCase $repository->shouldReceive('store')->andReturn($bill); $attachHelper->shouldReceive('saveAttachmentsForModel'); $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag); - $ruleGroupRepos->shouldReceive('count')->andReturn(1); - $ruleGroupRepos->shouldReceive('getActiveGroups')->andReturn(new Collection([RuleGroup::first()]))->once(); $data = [ 'name' => 'New Bill ' . random_int(1000, 9999), @@ -333,8 +330,6 @@ class BillControllerTest extends TestCase $repository->shouldReceive('store')->andReturn(new Bill); $attachHelper->shouldReceive('saveAttachmentsForModel'); $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag); - $ruleGroupRepos->shouldReceive('count')->andReturn(0); - $ruleGroupRepos->shouldReceive('store')->once()->withArgs([['title' => 'Rule group for bills','description'=> 'A special rule group for all the rules that involve bills.']])->andReturn(RuleGroup::first()); $data = [ 'name' => 'New Bill ' . random_int(1000, 9999), diff --git a/tests/Feature/Controllers/Rule/CreateControllerTest.php b/tests/Feature/Controllers/Rule/CreateControllerTest.php index f41453df93..87f54a9436 100644 --- a/tests/Feature/Controllers/Rule/CreateControllerTest.php +++ b/tests/Feature/Controllers/Rule/CreateControllerTest.php @@ -62,26 +62,6 @@ class CreateControllerTest extends TestCase $response = $this->get(route('rules.create', [1])); $response->assertStatus(200); $response->assertSee('