Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code for upgrade of various libraries.
James Cole4ca60ca92a23
diff --git a/app/Api/V1/Controllers/SummaryController.php b/app/Api/V1/Controllers/SummaryController.phpindex 5ad99006a8..929320e1d9 100644--- a/app/Api/V1/Controllers/SummaryController.php+++ b/app/Api/V1/Controllers/SummaryController.php@@ -364,7 +364,7 @@ class SummaryController extends Controller{/** @var User $user */$user = auth()->user();- $date = Carbon::create()->startOfDay();+ $date = Carbon::now()->startOfDay();// start and end in the future? use $enddiff --git a/app/Console/Commands/ApplyRules.php b/app/Console/Commands/ApplyRules.phpindex 5246fbffde..c8d051acab 100644--- a/app/Console/Commands/ApplyRules.php+++ b/app/Console/Commands/ApplyRules.php@@ -235,7 +235,7 @@ class ApplyRules extends Commandprivate function parseDates(): void{// parse start date.- $startDate = Carbon::create()->startOfMonth();+ $startDate = Carbon::now()->startOfMonth();$startString = $this->option('start_date');if (null === $startString) {/** @var JournalRepositoryInterface $repository */diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.phpindex 49caa3ca68..77a452d9a3 100644--- a/app/Http/Controllers/Json/BoxController.php+++ b/app/Http/Controllers/Json/BoxController.php@@ -243,7 +243,7 @@ class BoxController extends Controller*/public function netWorth(): JsonResponse{- $date = Carbon::create()->startOfDay();+ $date = Carbon::now()->startOfDay();// start and end in the future? use $endif ($this->notInSessionRange($date)) {diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.phpindex 37a792333c..4d1de2ed58 100644--- a/app/Support/Http/Controllers/GetConfigurationData.php+++ b/app/Support/Http/Controllers/GetConfigurationData.php@@ -140,12 +140,12 @@ trait GetConfigurationData}// last seven days:- $seven = Carbon::create()->subDays(7);+ $seven = Carbon::now()->subDays(7);$index = (string)trans('firefly.last_seven_days');$ranges[$index] = [$seven, new Carbon];// last 30 days:- $thirty = Carbon::create()->subDays(30);+ $thirty = Carbon::now()->subDays(30);$index = (string)trans('firefly.last_thirty_days');$ranges[$index] = [$thirty, new Carbon];diff --git a/tests/Feature/Controllers/Chart/AccountControllerTest.php b/tests/Feature/Controllers/Chart/AccountControllerTest.phpindex aaa73902a9..c0a0116c8e 100644--- a/tests/Feature/Controllers/Chart/AccountControllerTest.php+++ b/tests/Feature/Controllers/Chart/AccountControllerTest.php@@ -153,7 +153,7 @@ class AccountControllerTest extends TestCase$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);- $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromTimestamp(time())->startOfMonth());+ $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromFormat('U',time())->startOfMonth());$this->be($this->user());$this->changeDateRange($this->user(), $range);@@ -219,7 +219,7 @@ class AccountControllerTest extends TestCase$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]));- $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromTimestamp(time())->startOfMonth());+ $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromFormat('U',time())->startOfMonth());$this->be($this->user());$this->changeDateRange($this->user(), $range);@@ -313,7 +313,7 @@ class AccountControllerTest extends TestCase$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$account]));- $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromTimestamp(time())->startOfMonth());+ $accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromFormat('U',time())->startOfMonth());$this->be($this->user());$this->changeDateRange($this->user(), $range);diff --git a/tests/Feature/Controllers/Recurring/CreateControllerTest.php b/tests/Feature/Controllers/Recurring/CreateControllerTest.phpindex f078d99e88..f5f98f1a9d 100644--- a/tests/Feature/Controllers/Recurring/CreateControllerTest.php+++ b/tests/Feature/Controllers/Recurring/CreateControllerTest.php@@ -92,7 +92,7 @@ class CreateControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -147,7 +147,7 @@ class CreateControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -202,7 +202,7 @@ class CreateControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -257,7 +257,7 @@ class CreateControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -313,7 +313,7 @@ class CreateControllerTest extends TestCase$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -371,7 +371,7 @@ class CreateControllerTest extends TestCase$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),@@ -429,7 +429,7 @@ class CreateControllerTest extends TestCase$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['title' => 'hello' . random_int(1, 100000),diff --git a/tests/Feature/Controllers/Recurring/EditControllerTest.php b/tests/Feature/Controllers/Recurring/EditControllerTest.phpindex 70c9fa02e9..bdcb678020 100644--- a/tests/Feature/Controllers/Recurring/EditControllerTest.php+++ b/tests/Feature/Controllers/Recurring/EditControllerTest.php@@ -107,7 +107,7 @@ class EditControllerTest extends TestCase$recurringRepos->shouldReceive('update')->once();- $tomorrow = Carbon::create()->addDays(2);+ $tomorrow = Carbon::now()->addDays(2);$recurrence = $this->user()->recurrences()->first();$data = ['id' => $recurrence->id,diff --git a/tests/Feature/Controllers/ReportControllerTest.php b/tests/Feature/Controllers/ReportControllerTest.phpindex 27789c156a..688a2bd265 100644--- a/tests/Feature/Controllers/ReportControllerTest.php+++ b/tests/Feature/Controllers/ReportControllerTest.php@@ -82,8 +82,8 @@ class ReportControllerTest extends TestCase$budgetRepository->shouldReceive('cleanupBudgets');$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);@@ -115,8 +115,8 @@ class ReportControllerTest extends TestCase$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);@@ -141,8 +141,8 @@ class ReportControllerTest extends TestCase$generator = $this->mock(BYRG::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$reportHelper = $this->mock(ReportHelperInterface::class);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);@@ -171,8 +171,8 @@ class ReportControllerTest extends TestCase$generator = $this->mock(CYRG::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$reportHelper = $this->mock(ReportHelperInterface::class);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$budgetRepository->shouldReceive('cleanupBudgets');@@ -203,8 +203,8 @@ class ReportControllerTest extends TestCase$generator = $this->mock(SYRG::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$reportHelper = $this->mock(ReportHelperInterface::class);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);@@ -231,8 +231,8 @@ class ReportControllerTest extends TestCase$journalRepos = $this->mock(JournalRepositoryInterface::class);$fiscalHelper = $this->mock(FiscalHelperInterface::class);$reportHelper = $this->mock(ReportHelperInterface::class);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);@@ -823,8 +823,8 @@ class ReportControllerTest extends TestCase$fiscalHelper = $this->mock(FiscalHelperInterface::class);$reportHelper = $this->mock(ReportHelperInterface::class);$tag = $this->user()->tags()->find(1);- $start = Carbon::create()->startOfYear();- $end = Carbon::create()->endOfYear();+ $start = Carbon::now()->startOfYear();+ $end = Carbon::now()->endOfYear();$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);diff --git a/tests/Unit/Factory/RecurrenceFactoryTest.php b/tests/Unit/Factory/RecurrenceFactoryTest.phpindex 6cce08c376..2d519ac73b 100644--- a/tests/Unit/Factory/RecurrenceFactoryTest.php+++ b/tests/Unit/Factory/RecurrenceFactoryTest.php@@ -96,7 +96,7 @@ class RecurrenceFactoryTest extends TestCase$data = ['recurrence' => ['type' => 'withdrawal',- 'first_date' => Carbon::create()->addDay(),+ 'first_date' => Carbon::now()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),'description' => 'Description thing',@@ -190,7 +190,7 @@ class RecurrenceFactoryTest extends TestCase$data = ['recurrence' => ['type' => 'deposit',- 'first_date' => Carbon::create()->addDay(),+ 'first_date' => Carbon::now()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),'description' => 'Description thing',@@ -286,7 +286,7 @@ class RecurrenceFactoryTest extends TestCase$data = ['recurrence' => ['type' => 'withdrawal',- 'first_date' => Carbon::create()->addDay(),+ 'first_date' => Carbon::now()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),'description' => 'Description thing',@@ -380,7 +380,7 @@ class RecurrenceFactoryTest extends TestCase$data = ['recurrence' => ['type' => 'withdrawal',- 'first_date' => Carbon::create()->addDay(),+ 'first_date' => Carbon::now()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),'description' => 'Description thing',@@ -474,7 +474,7 @@ class RecurrenceFactoryTest extends TestCase$data = ['recurrence' => ['type' => 'transfer',- 'first_date' => Carbon::create()->addDay(),+ 'first_date' => Carbon::now()->addDay(),'repetitions' => 0,'title' => 'Test recurrence' . random_int(1, 100000),'description' => 'Description thing',diff --git a/tests/Unit/Generator/Report/Audit/MonthReportGeneratorTest.php b/tests/Unit/Generator/Report/Audit/MonthReportGeneratorTest.phpindex 4c8bb6befc..69fbf64d46 100644--- a/tests/Unit/Generator/Report/Audit/MonthReportGeneratorTest.php+++ b/tests/Unit/Generator/Report/Audit/MonthReportGeneratorTest.php@@ -61,8 +61,8 @@ class MonthReportGeneratorTest extends TestCase/** @var Account $account */$account = $this->user()->accounts()->where('account_type_id', 3)->first();$date = new Carbon;- $start = Carbon::create()->startOfMonth();- $end = Carbon::create()->endOfMonth();+ $start = Carbon::now()->startOfMonth();+ $end = Carbon::now()->endOfMonth();$generator = new MonthReportGenerator();$generator->setStartDate($start);$generator->setEndDate($end);@@ -103,8 +103,8 @@ class MonthReportGeneratorTest extends TestCase/** @var Account $account */$account = $this->user()->accounts()->where('account_type_id', 3)->first();$date = new Carbon;- $start = Carbon::create()->startOfMonth();- $end = Carbon::create()->endOfMonth();+ $start = Carbon::now()->startOfMonth();+ $end = Carbon::now()->endOfMonth();$generator = new MonthReportGenerator();$generator->setStartDate($start);$generator->setEndDate($end);@@ -143,8 +143,8 @@ class MonthReportGeneratorTest extends TestCase/** @var Account $account */$account = $this->user()->accounts()->where('account_type_id', 3)->first();$date = new Carbon;- $start = Carbon::create()->startOfMonth();- $end = Carbon::create()->endOfMonth();+ $start = Carbon::now()->startOfMonth();+ $end = Carbon::now()->endOfMonth();$generator = new MonthReportGenerator();$generator->setStartDate($start);$generator->setEndDate($end);@@ -190,8 +190,8 @@ class MonthReportGeneratorTest extends TestCase/** @var Account $account */$account = $this->user()->accounts()->where('account_type_id', 3)->first();$date = new Carbon;- $start = Carbon::create()->startOfMonth();- $end = Carbon::create()->endOfMonth();+ $start = Carbon::now()->startOfMonth();+ $end = Carbon::now()->endOfMonth();$generator = new MonthReportGenerator();$generator->setStartDate($start);$generator->setEndDate($end);diff --git a/tests/Unit/Import/Storage/ImportArrayStorageTest.php b/tests/Unit/Import/Storage/ImportArrayStorageTest.phpindex 77bf608492..d40334daba 100644--- a/tests/Unit/Import/Storage/ImportArrayStorageTest.php+++ b/tests/Unit/Import/Storage/ImportArrayStorageTest.php@@ -603,7 +603,7 @@ class ImportArrayStorageTest extends TestCasereturn['type' => 'transfer',- 'date' => Carbon::create()->format('Y-m-d'),+ 'date' => Carbon::now()->format('Y-m-d'),'tags' => '','user' => $this->user()->id,@@ -652,7 +652,7 @@ class ImportArrayStorageTest extends TestCasereturn['type' => 'withdrawal',- 'date' => Carbon::create()->format('Y-m-d'),+ 'date' => Carbon::now()->format('Y-m-d'),'tags' => '','user' => $this->user()->id,