diff --git a/tests/Api/V1/Controllers/AboutControllerTest.php b/tests/Api/V1/Controllers/AboutControllerTest.php index eeeaba4290..c901ecedd8 100644 --- a/tests/Api/V1/Controllers/AboutControllerTest.php +++ b/tests/Api/V1/Controllers/AboutControllerTest.php @@ -24,8 +24,9 @@ declare(strict_types=1); namespace Tests\Api\V1\Controllers; use Laravel\Passport\Passport; -use Tests\TestCase; use Log; +use Tests\TestCase; + /** * Class AboutControllerTest */ diff --git a/tests/Api/V1/Controllers/AccountControllerTest.php b/tests/Api/V1/Controllers/AccountControllerTest.php index a342fe2461..1b22e62ef3 100644 --- a/tests/Api/V1/Controllers/AccountControllerTest.php +++ b/tests/Api/V1/Controllers/AccountControllerTest.php @@ -28,8 +28,8 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Laravel\Passport\Passport; -use Tests\TestCase; use Log; +use Tests\TestCase; /** * Class AccountControllerTest diff --git a/tests/Api/V1/Controllers/TransactionControllerTest.php b/tests/Api/V1/Controllers/TransactionControllerTest.php index 1b7c43fd61..2da89ce3e6 100644 --- a/tests/Api/V1/Controllers/TransactionControllerTest.php +++ b/tests/Api/V1/Controllers/TransactionControllerTest.php @@ -26,6 +26,7 @@ namespace Tests\Api\V1\Controllers; use FireflyIII\Helpers\Collector\JournalCollector; use FireflyIII\Helpers\Collector\JournalCollectorInterface; +use FireflyIII\Helpers\Filter\NegativeAmountFilter; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; @@ -1349,7 +1350,7 @@ class TransactionControllerTest extends TestCase $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once(); $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once(); $collector->shouldReceive('setJournals')->andReturnSelf()->once(); - $collector->shouldReceive('addFilter')->andReturnSelf()->once(); + $collector->shouldReceive('addFilter')->withArgs([NegativeAmountFilter::class])->andReturnSelf()->once(); $collector->shouldReceive('getJournals')->andReturn($transactions); // test API @@ -1360,6 +1361,7 @@ class TransactionControllerTest extends TestCase 'data' => [ 'attributes' => [ 'description' => $journal->description, + 'type' => 'Deposit', ], 'links' => [ 0 => [], @@ -2172,8 +2174,8 @@ class TransactionControllerTest extends TestCase $accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest])); $journalRepos->shouldReceive('store')->andReturn($journal)->once(); - $piggy = $this->user()->piggyBanks()->first(); - $data = [ + $piggy = $this->user()->piggyBanks()->first(); + $data = [ 'description' => 'Some transfer #' . rand(1, 1000), 'date' => '2018-01-01', 'type' => 'transfer', @@ -2209,7 +2211,7 @@ class TransactionControllerTest extends TestCase $accountRepos->shouldReceive('setUser'); $accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('store')->andReturn($journal)->once(); - $data = [ + $data = [ 'description' => 'Some transaction #' . rand(1, 1000), 'date' => '2018-01-01', 'type' => 'withdrawal', @@ -2247,7 +2249,7 @@ class TransactionControllerTest extends TestCase $accountRepos->shouldReceive('setUser'); $accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('store')->andReturn($journal)->once(); - $data = [ + $data = [ 'description' => 'Some transaction #' . rand(1, 1000), 'date' => '2018-01-01', 'type' => 'withdrawal', @@ -2285,7 +2287,7 @@ class TransactionControllerTest extends TestCase */ public function testSuccessStoreTags() { - $tags = [ + $tags = [ 'TagOne' . rand(1, 1000), 'TagTwoBlarg' . rand(1, 1000), 'SomeThreeTag' . rand(1, 1000), @@ -2299,7 +2301,7 @@ class TransactionControllerTest extends TestCase $accountRepos->shouldReceive('setUser'); $accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('store')->andReturn($journal)->once(); - $data = [ + $data = [ 'description' => 'Some transaction #' . rand(1, 1000), 'date' => '2018-01-01', 'type' => 'withdrawal', @@ -2319,5 +2321,4 @@ class TransactionControllerTest extends TestCase $response = $this->post('/api/v1/transactions?include=tags', $data, ['Accept' => 'application/json']); $response->assertStatus(200); } - } \ No newline at end of file diff --git a/tests/Feature/Controllers/Account/ReconcileControllerTest.php b/tests/Feature/Controllers/Account/ReconcileControllerTest.php index e9d929fc9b..27dd4d6eca 100644 --- a/tests/Feature/Controllers/Account/ReconcileControllerTest.php +++ b/tests/Feature/Controllers/Account/ReconcileControllerTest.php @@ -31,8 +31,8 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Support\Collection; -use Tests\TestCase; use Log; +use Tests\TestCase; /** * Class ConfigurationControllerTest diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php index c9a037c2e5..ba83d35bb3 100644 --- a/tests/Feature/Controllers/AccountControllerTest.php +++ b/tests/Feature/Controllers/AccountControllerTest.php @@ -182,8 +182,8 @@ class AccountControllerTest extends TestCase $this->session(['start' => $date, 'end' => clone $date]); // mock stuff: - $tasker = $this->mock(AccountTaskerInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $tasker = $this->mock(AccountTaskerInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); @@ -222,7 +222,7 @@ class AccountControllerTest extends TestCase public function testShowBrokenInitial() { // mock - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $date = new Carbon; @@ -244,8 +244,8 @@ class AccountControllerTest extends TestCase public function testShowByDateEmpty(string $range) { // mock stuff - $collector = $this->mock(JournalCollectorInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $collector->shouldReceive('setAccounts')->andReturnSelf(); @@ -278,9 +278,9 @@ class AccountControllerTest extends TestCase public function testShowInitial() { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $date = new Carbon; $this->session(['start' => $date, 'end' => clone $date]); @@ -298,8 +298,8 @@ class AccountControllerTest extends TestCase public function testStore() { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(AccountRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make()); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -326,8 +326,8 @@ class AccountControllerTest extends TestCase public function testStoreAnother() { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(AccountRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make()); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -352,8 +352,8 @@ class AccountControllerTest extends TestCase public function testUpdate() { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(AccountRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('update')->once(); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -378,8 +378,8 @@ class AccountControllerTest extends TestCase public function testUpdateAgain() { // mock stuff - $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(AccountRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('update')->once(); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); diff --git a/tests/Feature/Controllers/Admin/LinkControllerTest.php b/tests/Feature/Controllers/Admin/LinkControllerTest.php index 9a442da258..95c0571b36 100644 --- a/tests/Feature/Controllers/Admin/LinkControllerTest.php +++ b/tests/Feature/Controllers/Admin/LinkControllerTest.php @@ -25,8 +25,9 @@ namespace Tests\Feature\Controllers\Admin; use FireflyIII\Models\LinkType; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use Illuminate\Support\Collection; -use Tests\TestCase; use Log; +use Tests\TestCase; + /** * Class LinkControllerTest * @@ -226,7 +227,7 @@ class LinkControllerTest extends TestCase public function testUpdateNonEditable() { $repository = $this->mock(LinkTypeRepositoryInterface::class); - $linkType = LinkType::where('editable', 0)->first(); + $linkType = LinkType::where('editable', 0)->first(); $data = [ 'name' => 'test ' . rand(1, 1000), diff --git a/tests/Feature/Controllers/Admin/UpdateControllerTest.php b/tests/Feature/Controllers/Admin/UpdateControllerTest.php index 119d978569..db791f2520 100644 --- a/tests/Feature/Controllers/Admin/UpdateControllerTest.php +++ b/tests/Feature/Controllers/Admin/UpdateControllerTest.php @@ -28,9 +28,9 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Configuration; use FireflyIII\Services\Github\Object\Release; use FireflyIII\Services\Github\Request\UpdateRequest; +use Log; use Mockery; use Tests\TestCase; -use Log; /** * Class UpdateControllerTest diff --git a/tests/Feature/Controllers/Admin/UserControllerTest.php b/tests/Feature/Controllers/Admin/UserControllerTest.php index 4f3d7aeec6..c6ed1b9257 100644 --- a/tests/Feature/Controllers/Admin/UserControllerTest.php +++ b/tests/Feature/Controllers/Admin/UserControllerTest.php @@ -24,8 +24,9 @@ namespace Tests\Feature\Controllers\Admin; use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Support\Collection; -use Tests\TestCase; use Log; +use Tests\TestCase; + /** * Class UserControllerTest * diff --git a/tests/Feature/Controllers/AttachmentControllerTest.php b/tests/Feature/Controllers/AttachmentControllerTest.php index 8da5e4c9c8..1b1fe59405 100644 --- a/tests/Feature/Controllers/AttachmentControllerTest.php +++ b/tests/Feature/Controllers/AttachmentControllerTest.php @@ -43,7 +43,7 @@ class AttachmentControllerTest extends TestCase { // mock stuff $attachRepository = $this->mock(AttachmentRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $this->be($this->user()); $response = $this->get(route('attachments.delete', [1])); @@ -112,7 +112,7 @@ class AttachmentControllerTest extends TestCase public function testEdit() { $attachRepository = $this->mock(AttachmentRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $this->be($this->user()); $response = $this->get(route('attachments.edit', [1])); diff --git a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php index 9f202ff36a..262f2410b6 100644 --- a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php +++ b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php @@ -23,8 +23,8 @@ declare(strict_types=1); namespace Tests\Feature\Controllers\Auth; use FireflyIII\Repositories\User\UserRepositoryInterface; -use Tests\TestCase; use Log; +use Tests\TestCase; /** * Class ForgotPasswordControllerTest @@ -50,6 +50,7 @@ class ForgotPasswordControllerTest extends TestCase */ public function testSendResetLinkEmail() { + $repository = $this->mock(UserRepositoryInterface::class); $repository->shouldReceive('hasRole')->andReturn(false)->once(); $data = [ diff --git a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php index 7cbbda6cba..5792d1cdb8 100644 --- a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php +++ b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php @@ -24,9 +24,9 @@ namespace Tests\Feature\Controllers\Auth; use FireflyIII\Models\Preference; use Google2FA; +use Log; use Preferences; use Tests\TestCase; -use Log; /** * Class TwoFactorControllerTest diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.php index f8243d1481..faed7e71b7 100644 --- a/tests/Feature/Controllers/BudgetControllerTest.php +++ b/tests/Feature/Controllers/BudgetControllerTest.php @@ -295,7 +295,7 @@ class BudgetControllerTest extends TestCase { // mock stuff $accountRepos = $this->mock(AccountRepositoryInterface::class); - $repository = $this->mock(BudgetRepositoryInterface::class); + $repository = $this->mock(BudgetRepositoryInterface::class); $repository->shouldReceive('getAvailableBudget')->andReturn('100.123'); $accountRepos->shouldReceive('setUser'); @@ -314,7 +314,7 @@ class BudgetControllerTest extends TestCase { // mock stuff $accountRepos = $this->mock(AccountRepositoryInterface::class); - $repository = $this->mock(BudgetRepositoryInterface::class); + $repository = $this->mock(BudgetRepositoryInterface::class); $repository->shouldReceive('getAvailableBudget')->andReturn('100.123'); $accountRepos->shouldReceive('setUser'); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); diff --git a/tests/Feature/Controllers/CategoryControllerTest.php b/tests/Feature/Controllers/CategoryControllerTest.php index 5545a2746d..127abe15a2 100644 --- a/tests/Feature/Controllers/CategoryControllerTest.php +++ b/tests/Feature/Controllers/CategoryControllerTest.php @@ -70,8 +70,8 @@ class CategoryControllerTest extends TestCase { // mock stuff $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $this->be($this->user()); @@ -88,8 +88,8 @@ class CategoryControllerTest extends TestCase { // mock stuff $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $categoryRepos->shouldReceive('destroy')->andReturn(true); @@ -108,8 +108,8 @@ class CategoryControllerTest extends TestCase { // mock stuff $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $this->be($this->user()); @@ -126,10 +126,10 @@ class CategoryControllerTest extends TestCase public function testIndex() { // mock stuff - $category = factory(Category::class)->make(); + $category = factory(Category::class)->make(); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]))->once(); $categoryRepos->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); @@ -151,10 +151,10 @@ class CategoryControllerTest extends TestCase public function testNoCategory(string $range) { // mock stuff - $collector = $this->mock(JournalCollectorInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); @@ -188,10 +188,10 @@ class CategoryControllerTest extends TestCase public function testNoCategoryAll(string $range) { // mock stuff - $collector = $this->mock(JournalCollectorInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); @@ -224,10 +224,10 @@ class CategoryControllerTest extends TestCase public function testNoCategoryDate(string $range) { // mock stuff - $collector = $this->mock(JournalCollectorInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); @@ -267,10 +267,10 @@ class CategoryControllerTest extends TestCase */ public function testShow(string $range) { - $transaction = factory(Transaction::class)->make(); + $transaction = factory(Transaction::class)->make(); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); - $accountRepos = $this->mock(AccountRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $accountRepos = $this->mock(AccountRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); // mock stuff diff --git a/tests/Feature/Controllers/Chart/BudgetControllerTest.php b/tests/Feature/Controllers/Chart/BudgetControllerTest.php index f6ff72de33..c15058e09d 100644 --- a/tests/Feature/Controllers/Chart/BudgetControllerTest.php +++ b/tests/Feature/Controllers/Chart/BudgetControllerTest.php @@ -112,10 +112,10 @@ class BudgetControllerTest extends TestCase public function testExpenseAsset(string $range) { $budgetRepository = $this->mock(BudgetRepositoryInterface::class); - $generator = $this->mock(GeneratorInterface::class); - $collector = $this->mock(JournalCollectorInterface::class); - $transactions = factory(Transaction::class, 10)->make(); - $accountRepos = $this->mock(AccountRepositoryInterface::class); + $generator = $this->mock(GeneratorInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); + $transactions = factory(Transaction::class, 10)->make(); + $accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $collector->shouldReceive('setAllAssetAccounts')->once()->andReturnSelf(); @@ -140,13 +140,12 @@ class BudgetControllerTest extends TestCase */ public function testExpenseCategory(string $range) { - $generator = $this->mock(GeneratorInterface::class); - $collector = $this->mock(JournalCollectorInterface::class); - $catRepos = $this->mock(CategoryRepositoryInterface::class); + $generator = $this->mock(GeneratorInterface::class); + $collector = $this->mock(JournalCollectorInterface::class); + $catRepos = $this->mock(CategoryRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class); - $transactions = factory(Transaction::class, 10)->make(); $categories = factory(Category::class, 10)->make(); @@ -178,7 +177,7 @@ class BudgetControllerTest extends TestCase $generator = $this->mock(GeneratorInterface::class); $collector = $this->mock(JournalCollectorInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class); - $repository = $this->mock(BudgetRepositoryInterface::class); + $repository = $this->mock(BudgetRepositoryInterface::class); $transactions = factory(Transaction::class, 10)->make(); $accounts = factory(Account::class, 10)->make(); diff --git a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php index 0bd3f6423d..69151a3bb8 100644 --- a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php +++ b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php @@ -52,8 +52,8 @@ class BudgetReportControllerTest extends TestCase public function testAccountExpense() { $budgetRepos = $this->mock(BudgetRepositoryInterface::class); - $generator = $this->mock(GeneratorInterface::class); - $pieChart = $this->mock(MetaPieChartInterface::class); + $generator = $this->mock(GeneratorInterface::class); + $pieChart = $this->mock(MetaPieChartInterface::class); $pieChart->shouldReceive('setAccounts')->once()->andReturnSelf(); @@ -75,8 +75,8 @@ class BudgetReportControllerTest extends TestCase public function testBudgetExpense() { $budgetRepos = $this->mock(BudgetRepositoryInterface::class); - $generator = $this->mock(GeneratorInterface::class); - $pieChart = $this->mock(MetaPieChartInterface::class); + $generator = $this->mock(GeneratorInterface::class); + $pieChart = $this->mock(MetaPieChartInterface::class); $pieChart->shouldReceive('setAccounts')->once()->andReturnSelf(); $pieChart->shouldReceive('setBudgets')->once()->andReturnSelf(); diff --git a/tests/Feature/Controllers/Chart/CategoryControllerTest.php b/tests/Feature/Controllers/Chart/CategoryControllerTest.php index 6f227873b1..b939d38186 100644 --- a/tests/Feature/Controllers/Chart/CategoryControllerTest.php +++ b/tests/Feature/Controllers/Chart/CategoryControllerTest.php @@ -54,7 +54,7 @@ class CategoryControllerTest extends TestCase $repository = $this->mock(CategoryRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class); $generator = $this->mock(GeneratorInterface::class); - $firstUse = new Carbon; + $firstUse = new Carbon; $firstUse->subDays(3); $repository->shouldReceive('spentInPeriod')->andReturn('0'); diff --git a/tests/Feature/Controllers/CurrencyControllerTest.php b/tests/Feature/Controllers/CurrencyControllerTest.php index f2b64054a1..42a8033878 100644 --- a/tests/Feature/Controllers/CurrencyControllerTest.php +++ b/tests/Feature/Controllers/CurrencyControllerTest.php @@ -46,8 +46,8 @@ class CurrencyControllerTest extends TestCase { // mock stuff $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $userRepos->shouldReceive('hasRole')->once()->andReturn(false); @@ -106,8 +106,8 @@ class CurrencyControllerTest extends TestCase { // mock stuff $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $userRepos->shouldReceive('hasRole')->once()->andReturn(true); @@ -126,8 +126,8 @@ class CurrencyControllerTest extends TestCase { // mock stuff $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -187,8 +187,8 @@ class CurrencyControllerTest extends TestCase { // mock stuff $currencyRepos = $this->mock(CurrencyRepositoryInterface::class); - $userRepos = $this->mock(UserRepositoryInterface::class); - $journalRepos = $this->mock(JournalRepositoryInterface::class); + $userRepos = $this->mock(UserRepositoryInterface::class); + $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $userRepos->shouldReceive('hasRole')->once()->andReturn(true); diff --git a/tests/Feature/Controllers/DebugControllerTest.php b/tests/Feature/Controllers/DebugControllerTest.php index 4c7d8f6649..4c66eebdf9 100644 --- a/tests/Feature/Controllers/DebugControllerTest.php +++ b/tests/Feature/Controllers/DebugControllerTest.php @@ -22,14 +22,6 @@ declare(strict_types=1); namespace Tests\Feature\Controllers; -use FireflyIII\Helpers\Collector\JournalCollectorInterface; -use FireflyIII\Models\Account; -use FireflyIII\Models\AccountType; -use FireflyIII\Models\TransactionJournal; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\Bill\BillRepositoryInterface; -use FireflyIII\Repositories\Journal\JournalRepositoryInterface; -use Illuminate\Support\Collection; use Tests\TestCase; /** diff --git a/tests/Feature/Controllers/Import/IndexControllerTest.php b/tests/Feature/Controllers/Import/IndexControllerTest.php index 5b2ae47799..9d05a54d1f 100644 --- a/tests/Feature/Controllers/Import/IndexControllerTest.php +++ b/tests/Feature/Controllers/Import/IndexControllerTest.php @@ -81,7 +81,7 @@ class IndexControllerTest extends TestCase public function testStart() { $repository = $this->mock(ImportJobRepositoryInterface::class); - $routine = $this->mock(FileRoutine::class); + $routine = $this->mock(FileRoutine::class); $routine->shouldReceive('setJob')->once(); $routine->shouldReceive('run')->once()->andReturn(true); @@ -97,7 +97,7 @@ class IndexControllerTest extends TestCase public function testStartFailed() { $repository = $this->mock(ImportJobRepositoryInterface::class); - $routine = $this->mock(FileRoutine::class); + $routine = $this->mock(FileRoutine::class); $routine->shouldReceive('setJob')->once(); $routine->shouldReceive('run')->once()->andReturn(false); diff --git a/tests/Feature/Controllers/JavascriptControllerTest.php b/tests/Feature/Controllers/JavascriptControllerTest.php index 20ebcff46c..227c847e0e 100644 --- a/tests/Feature/Controllers/JavascriptControllerTest.php +++ b/tests/Feature/Controllers/JavascriptControllerTest.php @@ -22,7 +22,6 @@ declare(strict_types=1); namespace Tests\Feature\Controllers; -use FireflyIII\Factory\AccountFactory; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionCurrency; diff --git a/tests/Feature/Controllers/Report/OperationsControllerTest.php b/tests/Feature/Controllers/Report/OperationsControllerTest.php index 77a80b6df4..16b4e8f144 100644 --- a/tests/Feature/Controllers/Report/OperationsControllerTest.php +++ b/tests/Feature/Controllers/Report/OperationsControllerTest.php @@ -22,10 +22,6 @@ declare(strict_types=1); namespace Tests\Feature\Controllers\Report; -use FireflyIII\Helpers\Collector\JournalCollectorInterface; -use FireflyIII\Helpers\Filter\InternalTransferFilter; -use FireflyIII\Models\Transaction; -use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountTaskerInterface; use Tests\TestCase; @@ -43,7 +39,7 @@ class OperationsControllerTest extends TestCase */ public function testExpenses() { - $tasker = $this->mock(AccountTaskerInterface::class); + $tasker = $this->mock(AccountTaskerInterface::class); $tasker->shouldReceive('getExpenseReport')->andReturn([]); $this->be($this->user()); @@ -56,7 +52,7 @@ class OperationsControllerTest extends TestCase */ public function testIncome() { - $tasker = $this->mock(AccountTaskerInterface::class); + $tasker = $this->mock(AccountTaskerInterface::class); $tasker->shouldReceive('getIncomeReport')->andReturn([]); $this->be($this->user()); @@ -69,7 +65,7 @@ class OperationsControllerTest extends TestCase */ public function testOperations() { - $tasker = $this->mock(AccountTaskerInterface::class); + $tasker = $this->mock(AccountTaskerInterface::class); $tasker->shouldReceive('getExpenseReport')->andReturn([]); $tasker->shouldReceive('getIncomeReport')->andReturn([]); diff --git a/tests/Feature/Controllers/ReportControllerTest.php b/tests/Feature/Controllers/ReportControllerTest.php index cecae0a6ab..e9700b667f 100644 --- a/tests/Feature/Controllers/ReportControllerTest.php +++ b/tests/Feature/Controllers/ReportControllerTest.php @@ -549,7 +549,7 @@ class ReportControllerTest extends TestCase $journalRepos = $this->mock(JournalRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class); - $tag = $this->user()->tags()->find(1); + $tag = $this->user()->tags()->find(1); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice(); @@ -603,7 +603,7 @@ class ReportControllerTest extends TestCase $categoryRepos = $this->mock(CategoryRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class); $generator = $this->mock(TYRG::class); - $tag = $this->user()->tags()->find(1); + $tag = $this->user()->tags()->find(1); $tagRepos->shouldReceive('setUser'); $tagRepos->shouldReceive('get')->andReturn(new Collection([$tag])); diff --git a/tests/Feature/Controllers/TagControllerTest.php b/tests/Feature/Controllers/TagControllerTest.php index bebbb584e2..3d2ca65bab 100644 --- a/tests/Feature/Controllers/TagControllerTest.php +++ b/tests/Feature/Controllers/TagControllerTest.php @@ -47,7 +47,7 @@ class TagControllerTest extends TestCase public function testCreate() { // mock stuff - $tagRepos = $this->mock(TagRepositoryInterface::class); + $tagRepos = $this->mock(TagRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -63,7 +63,7 @@ class TagControllerTest extends TestCase public function testDelete() { // mock stuff - $tagRepos = $this->mock(TagRepositoryInterface::class); + $tagRepos = $this->mock(TagRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -96,7 +96,7 @@ class TagControllerTest extends TestCase public function testEdit() { // mock stuff - $tagRepos = $this->mock(TagRepositoryInterface::class); + $tagRepos = $this->mock(TagRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); diff --git a/tests/Feature/Controllers/Transaction/BulkControllerTest.php b/tests/Feature/Controllers/Transaction/BulkControllerTest.php index a64d645edc..749f8a9f19 100644 --- a/tests/Feature/Controllers/Transaction/BulkControllerTest.php +++ b/tests/Feature/Controllers/Transaction/BulkControllerTest.php @@ -22,7 +22,6 @@ declare(strict_types=1); namespace Tests\Feature\Controllers\Transaction; -use DB; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; @@ -86,8 +85,8 @@ class BulkControllerTest extends TestCase // default transactions $collection = $this->user()->transactionJournals()->take(4)->get(); - $allIds = $collection->pluck('id')->toArray(); - $route = route('transactions.bulk.edit', join(',', $allIds)); + $allIds = $collection->pluck('id')->toArray(); + $route = route('transactions.bulk.edit', join(',', $allIds)); $this->be($this->user()); $response = $this->get($route); $response->assertStatus(200); @@ -122,8 +121,8 @@ class BulkControllerTest extends TestCase // default transactions $collection = $this->user()->transactionJournals()->take(4)->get(); - $allIds = $collection->pluck('id')->toArray(); - $route = route('transactions.bulk.edit', join(',', $allIds)); + $allIds = $collection->pluck('id')->toArray(); + $route = route('transactions.bulk.edit', join(',', $allIds)); $this->be($this->user()); $response = $this->get($route); $response->assertStatus(200); diff --git a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php b/tests/Feature/Controllers/Transaction/ConvertControllerTest.php index b11897fa2f..ae7c786ea6 100644 --- a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php +++ b/tests/Feature/Controllers/Transaction/ConvertControllerTest.php @@ -369,7 +369,7 @@ class ConvertControllerTest extends TestCase { // mock stuff $accountRepos = $this->mock(AccountRepositoryInterface::class); - $repository = $this->mock(JournalRepositoryInterface::class); + $repository = $this->mock(JournalRepositoryInterface::class); $repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); diff --git a/tests/Feature/Controllers/Transaction/LinkControllerTest.php b/tests/Feature/Controllers/Transaction/LinkControllerTest.php index 5904b15a24..871bebe9ff 100644 --- a/tests/Feature/Controllers/Transaction/LinkControllerTest.php +++ b/tests/Feature/Controllers/Transaction/LinkControllerTest.php @@ -56,7 +56,7 @@ class LinkControllerTest extends TestCase public function testDestroy() { $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(LinkTypeRepositoryInterface::class); + $repository = $this->mock(LinkTypeRepositoryInterface::class); $repository->shouldReceive('destroyLink'); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -127,7 +127,7 @@ class LinkControllerTest extends TestCase { $journalRepos = $this->mock(JournalRepositoryInterface::class); $linkRepos = $this->mock(LinkTypeRepositoryInterface::class); - $data = [ + $data = [ 'link_other' => 0, 'link_type' => '1_inward', ]; @@ -147,7 +147,7 @@ class LinkControllerTest extends TestCase public function testSwitchLink() { $journalRepos = $this->mock(JournalRepositoryInterface::class); - $repository = $this->mock(LinkTypeRepositoryInterface::class); + $repository = $this->mock(LinkTypeRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('switchLink')->andReturn(false); $this->be($this->user()); diff --git a/tests/Feature/Controllers/Transaction/MassControllerTest.php b/tests/Feature/Controllers/Transaction/MassControllerTest.php index 9b0c042908..8492eab6d8 100644 --- a/tests/Feature/Controllers/Transaction/MassControllerTest.php +++ b/tests/Feature/Controllers/Transaction/MassControllerTest.php @@ -22,7 +22,6 @@ declare(strict_types=1); namespace Tests\Feature\Controllers\Transaction; -use DB; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; @@ -92,7 +91,7 @@ class MassControllerTest extends TestCase { $journalRepos = $this->mock(JournalRepositoryInterface::class); - $transfers = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->take(2)->get(); + $transfers = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->take(2)->get(); $transfersArray = $transfers->pluck('id')->toArray(); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); @@ -113,7 +112,6 @@ class MassControllerTest extends TestCase $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection); - $this->be($this->user()); $response = $this->get(route('transactions.mass.edit', $transfersArray)); $response->assertStatus(200); @@ -151,8 +149,8 @@ class MassControllerTest extends TestCase // default transactions $collection = $this->user()->transactionJournals()->take(4)->get(); - $allIds = $collection->pluck('id')->toArray(); - $route = route('transactions.mass.edit', join(',', $allIds)); + $allIds = $collection->pluck('id')->toArray(); + $route = route('transactions.mass.edit', join(',', $allIds)); $this->be($this->user()); $response = $this->get($route); $response->assertStatus(200); @@ -191,13 +189,13 @@ class MassControllerTest extends TestCase // default transactions $collection = $this->user()->transactionJournals()->take(4)->get(); - $allIds = $collection->pluck('id')->toArray(); + $allIds = $collection->pluck('id')->toArray(); $this->be($this->user()); $response = $this->get(route('transactions.mass.edit', join(',', $allIds))); $response->assertStatus(200); $response->assertSee('Edit a number of transactions'); - $response->assertSessionHas('error','You have selected no valid transactions to edit.'); + $response->assertSessionHas('error', 'You have selected no valid transactions to edit.'); // has bread crumb $response->assertSee('