Code for upgrade of various libraries.

This commit is contained in:
James Cole
2019-03-02 21:18:26 +01:00
parent 48219c9af3
commit 4ca60ca92a
11 changed files with 45 additions and 45 deletions

View File

@@ -364,7 +364,7 @@ class SummaryController extends Controller
{ {
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$date = Carbon::create()->startOfDay(); $date = Carbon::now()->startOfDay();
// start and end in the future? use $end // start and end in the future? use $end

View File

@@ -235,7 +235,7 @@ class ApplyRules extends Command
private function parseDates(): void private function parseDates(): void
{ {
// parse start date. // parse start date.
$startDate = Carbon::create()->startOfMonth(); $startDate = Carbon::now()->startOfMonth();
$startString = $this->option('start_date'); $startString = $this->option('start_date');
if (null === $startString) { if (null === $startString) {
/** @var JournalRepositoryInterface $repository */ /** @var JournalRepositoryInterface $repository */

View File

@@ -243,7 +243,7 @@ class BoxController extends Controller
*/ */
public function netWorth(): JsonResponse public function netWorth(): JsonResponse
{ {
$date = Carbon::create()->startOfDay(); $date = Carbon::now()->startOfDay();
// start and end in the future? use $end // start and end in the future? use $end
if ($this->notInSessionRange($date)) { if ($this->notInSessionRange($date)) {

View File

@@ -140,12 +140,12 @@ trait GetConfigurationData
} }
// last seven days: // last seven days:
$seven = Carbon::create()->subDays(7); $seven = Carbon::now()->subDays(7);
$index = (string)trans('firefly.last_seven_days'); $index = (string)trans('firefly.last_seven_days');
$ranges[$index] = [$seven, new Carbon]; $ranges[$index] = [$seven, new Carbon];
// last 30 days: // last 30 days:
$thirty = Carbon::create()->subDays(30); $thirty = Carbon::now()->subDays(30);
$index = (string)trans('firefly.last_thirty_days'); $index = (string)trans('firefly.last_thirty_days');
$ranges[$index] = [$thirty, new Carbon]; $ranges[$index] = [$thirty, new Carbon];

View File

@@ -153,7 +153,7 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction])); $collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]); $generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection); $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->be($this->user());
$this->changeDateRange($this->user(), $range); $this->changeDateRange($this->user(), $range);
@@ -219,7 +219,7 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction])); $collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]); $generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category])); $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->be($this->user());
$this->changeDateRange($this->user(), $range); $this->changeDateRange($this->user(), $range);
@@ -313,7 +313,7 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction])); $collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
$generator->shouldReceive('multiCurrencyPieChart')->andReturn([]); $generator->shouldReceive('multiCurrencyPieChart')->andReturn([]);
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$account])); $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->be($this->user());
$this->changeDateRange($this->user(), $range); $this->changeDateRange($this->user(), $range);

View File

@@ -92,7 +92,7 @@ class CreateControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -147,7 +147,7 @@ class CreateControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -202,7 +202,7 @@ class CreateControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -257,7 +257,7 @@ class CreateControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -313,7 +313,7 @@ class CreateControllerTest extends TestCase
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -371,7 +371,7 @@ class CreateControllerTest extends TestCase
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),
@@ -429,7 +429,7 @@ class CreateControllerTest extends TestCase
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'title' => 'hello' . random_int(1, 100000), 'title' => 'hello' . random_int(1, 100000),

View File

@@ -107,7 +107,7 @@ class EditControllerTest extends TestCase
$recurringRepos->shouldReceive('update')->once(); $recurringRepos->shouldReceive('update')->once();
$tomorrow = Carbon::create()->addDays(2); $tomorrow = Carbon::now()->addDays(2);
$recurrence = $this->user()->recurrences()->first(); $recurrence = $this->user()->recurrences()->first();
$data = [ $data = [
'id' => $recurrence->id, 'id' => $recurrence->id,

View File

@@ -82,8 +82,8 @@ class ReportControllerTest extends TestCase
$budgetRepository->shouldReceive('cleanupBudgets'); $budgetRepository->shouldReceive('cleanupBudgets');
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
@@ -115,8 +115,8 @@ class ReportControllerTest extends TestCase
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
@@ -141,8 +141,8 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(BYRG::class); $generator = $this->mock(BYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$reportHelper = $this->mock(ReportHelperInterface::class); $reportHelper = $this->mock(ReportHelperInterface::class);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
@@ -171,8 +171,8 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(CYRG::class); $generator = $this->mock(CYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$reportHelper = $this->mock(ReportHelperInterface::class); $reportHelper = $this->mock(ReportHelperInterface::class);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$budgetRepository->shouldReceive('cleanupBudgets'); $budgetRepository->shouldReceive('cleanupBudgets');
@@ -203,8 +203,8 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(SYRG::class); $generator = $this->mock(SYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$reportHelper = $this->mock(ReportHelperInterface::class); $reportHelper = $this->mock(ReportHelperInterface::class);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
@@ -231,8 +231,8 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$fiscalHelper = $this->mock(FiscalHelperInterface::class); $fiscalHelper = $this->mock(FiscalHelperInterface::class);
$reportHelper = $this->mock(ReportHelperInterface::class); $reportHelper = $this->mock(ReportHelperInterface::class);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
@@ -823,8 +823,8 @@ class ReportControllerTest extends TestCase
$fiscalHelper = $this->mock(FiscalHelperInterface::class); $fiscalHelper = $this->mock(FiscalHelperInterface::class);
$reportHelper = $this->mock(ReportHelperInterface::class); $reportHelper = $this->mock(ReportHelperInterface::class);
$tag = $this->user()->tags()->find(1); $tag = $this->user()->tags()->find(1);
$start = Carbon::create()->startOfYear(); $start = Carbon::now()->startOfYear();
$end = Carbon::create()->endOfYear(); $end = Carbon::now()->endOfYear();
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start); $fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end); $fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);

View File

@@ -96,7 +96,7 @@ class RecurrenceFactoryTest extends TestCase
$data = [ $data = [
'recurrence' => [ 'recurrence' => [
'type' => 'withdrawal', 'type' => 'withdrawal',
'first_date' => Carbon::create()->addDay(), 'first_date' => Carbon::now()->addDay(),
'repetitions' => 0, 'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000), 'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing', 'description' => 'Description thing',
@@ -190,7 +190,7 @@ class RecurrenceFactoryTest extends TestCase
$data = [ $data = [
'recurrence' => [ 'recurrence' => [
'type' => 'deposit', 'type' => 'deposit',
'first_date' => Carbon::create()->addDay(), 'first_date' => Carbon::now()->addDay(),
'repetitions' => 0, 'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000), 'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing', 'description' => 'Description thing',
@@ -286,7 +286,7 @@ class RecurrenceFactoryTest extends TestCase
$data = [ $data = [
'recurrence' => [ 'recurrence' => [
'type' => 'withdrawal', 'type' => 'withdrawal',
'first_date' => Carbon::create()->addDay(), 'first_date' => Carbon::now()->addDay(),
'repetitions' => 0, 'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000), 'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing', 'description' => 'Description thing',
@@ -380,7 +380,7 @@ class RecurrenceFactoryTest extends TestCase
$data = [ $data = [
'recurrence' => [ 'recurrence' => [
'type' => 'withdrawal', 'type' => 'withdrawal',
'first_date' => Carbon::create()->addDay(), 'first_date' => Carbon::now()->addDay(),
'repetitions' => 0, 'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000), 'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing', 'description' => 'Description thing',
@@ -474,7 +474,7 @@ class RecurrenceFactoryTest extends TestCase
$data = [ $data = [
'recurrence' => [ 'recurrence' => [
'type' => 'transfer', 'type' => 'transfer',
'first_date' => Carbon::create()->addDay(), 'first_date' => Carbon::now()->addDay(),
'repetitions' => 0, 'repetitions' => 0,
'title' => 'Test recurrence' . random_int(1, 100000), 'title' => 'Test recurrence' . random_int(1, 100000),
'description' => 'Description thing', 'description' => 'Description thing',

View File

@@ -61,8 +61,8 @@ class MonthReportGeneratorTest extends TestCase
/** @var Account $account */ /** @var Account $account */
$account = $this->user()->accounts()->where('account_type_id', 3)->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first();
$date = new Carbon; $date = new Carbon;
$start = Carbon::create()->startOfMonth(); $start = Carbon::now()->startOfMonth();
$end = Carbon::create()->endOfMonth(); $end = Carbon::now()->endOfMonth();
$generator = new MonthReportGenerator(); $generator = new MonthReportGenerator();
$generator->setStartDate($start); $generator->setStartDate($start);
$generator->setEndDate($end); $generator->setEndDate($end);
@@ -103,8 +103,8 @@ class MonthReportGeneratorTest extends TestCase
/** @var Account $account */ /** @var Account $account */
$account = $this->user()->accounts()->where('account_type_id', 3)->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first();
$date = new Carbon; $date = new Carbon;
$start = Carbon::create()->startOfMonth(); $start = Carbon::now()->startOfMonth();
$end = Carbon::create()->endOfMonth(); $end = Carbon::now()->endOfMonth();
$generator = new MonthReportGenerator(); $generator = new MonthReportGenerator();
$generator->setStartDate($start); $generator->setStartDate($start);
$generator->setEndDate($end); $generator->setEndDate($end);
@@ -143,8 +143,8 @@ class MonthReportGeneratorTest extends TestCase
/** @var Account $account */ /** @var Account $account */
$account = $this->user()->accounts()->where('account_type_id', 3)->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first();
$date = new Carbon; $date = new Carbon;
$start = Carbon::create()->startOfMonth(); $start = Carbon::now()->startOfMonth();
$end = Carbon::create()->endOfMonth(); $end = Carbon::now()->endOfMonth();
$generator = new MonthReportGenerator(); $generator = new MonthReportGenerator();
$generator->setStartDate($start); $generator->setStartDate($start);
$generator->setEndDate($end); $generator->setEndDate($end);
@@ -190,8 +190,8 @@ class MonthReportGeneratorTest extends TestCase
/** @var Account $account */ /** @var Account $account */
$account = $this->user()->accounts()->where('account_type_id', 3)->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first();
$date = new Carbon; $date = new Carbon;
$start = Carbon::create()->startOfMonth(); $start = Carbon::now()->startOfMonth();
$end = Carbon::create()->endOfMonth(); $end = Carbon::now()->endOfMonth();
$generator = new MonthReportGenerator(); $generator = new MonthReportGenerator();
$generator->setStartDate($start); $generator->setStartDate($start);
$generator->setEndDate($end); $generator->setEndDate($end);

View File

@@ -603,7 +603,7 @@ class ImportArrayStorageTest extends TestCase
return return
[ [
'type' => 'transfer', 'type' => 'transfer',
'date' => Carbon::create()->format('Y-m-d'), 'date' => Carbon::now()->format('Y-m-d'),
'tags' => '', 'tags' => '',
'user' => $this->user()->id, 'user' => $this->user()->id,
@@ -652,7 +652,7 @@ class ImportArrayStorageTest extends TestCase
return return
[ [
'type' => 'withdrawal', 'type' => 'withdrawal',
'date' => Carbon::create()->format('Y-m-d'), 'date' => Carbon::now()->format('Y-m-d'),
'tags' => '', 'tags' => '',
'user' => $this->user()->id, 'user' => $this->user()->id,