From e0c76695eec604ff298320f04c4c05a4ed66b3ad Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 24 Jun 2025 13:25:03 +0200 Subject: [PATCH] Fix tests --- app/Support/Navigation.php | 4 ++-- tests/integration/Api/Autocomplete/AccountControllerTest.php | 2 +- tests/integration/Api/Autocomplete/BillControllerTest.php | 2 +- tests/integration/Api/Autocomplete/BudgetControllerTest.php | 2 +- tests/integration/Api/Autocomplete/CategoryControllerTest.php | 2 +- tests/integration/Api/Autocomplete/CurrencyControllerTest.php | 2 +- .../Api/Autocomplete/ObjectGroupControllerTest.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 2549fbba95..7b607be819 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -599,7 +599,7 @@ class Navigation */ public function preferredRangeFormat(Carbon $start, Carbon $end): string { - if ((int) $start->diffInMonths($end, true) > 1) { + if ((int) $start->diffInMonths($end, true) > 1 && (int) $start->diffInMonths($end, true) <= 12) { return '1M'; } @@ -616,7 +616,7 @@ class Navigation */ public function preferredSqlFormat(Carbon $start, Carbon $end): string { - if ((int) $start->diffInMonths($end, true) > 1) { + if ((int) $start->diffInMonths($end, true) > 1 && (int) $start->diffInMonths($end, true) <= 12) { return '%Y-%m'; } diff --git a/tests/integration/Api/Autocomplete/AccountControllerTest.php b/tests/integration/Api/Autocomplete/AccountControllerTest.php index 22cbe5a117..eb4b56ce37 100644 --- a/tests/integration/Api/Autocomplete/AccountControllerTest.php +++ b/tests/integration/Api/Autocomplete/AccountControllerTest.php @@ -44,6 +44,6 @@ final class AccountControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.accounts'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } } diff --git a/tests/integration/Api/Autocomplete/BillControllerTest.php b/tests/integration/Api/Autocomplete/BillControllerTest.php index f94daa714a..7dc6b950b7 100644 --- a/tests/integration/Api/Autocomplete/BillControllerTest.php +++ b/tests/integration/Api/Autocomplete/BillControllerTest.php @@ -84,7 +84,7 @@ final class BillControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.bills'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } public function testGivenAuthenticatedRequestWhenCallingTheBillsEndpointThenReturns200HttpCode(): void diff --git a/tests/integration/Api/Autocomplete/BudgetControllerTest.php b/tests/integration/Api/Autocomplete/BudgetControllerTest.php index 8e27714807..e137f5d262 100644 --- a/tests/integration/Api/Autocomplete/BudgetControllerTest.php +++ b/tests/integration/Api/Autocomplete/BudgetControllerTest.php @@ -78,7 +78,7 @@ final class BudgetControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.budgets'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturns200HttpCode(): void diff --git a/tests/integration/Api/Autocomplete/CategoryControllerTest.php b/tests/integration/Api/Autocomplete/CategoryControllerTest.php index 492b103669..9456cf4001 100644 --- a/tests/integration/Api/Autocomplete/CategoryControllerTest.php +++ b/tests/integration/Api/Autocomplete/CategoryControllerTest.php @@ -77,7 +77,7 @@ final class CategoryControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.categories'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } public function testGivenAuthenticatedRequestWhenCallingTheCategoriesEndpointThenReturns200HttpCode(): void diff --git a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php index 80f92f7079..efdd02a866 100644 --- a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php +++ b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php @@ -80,7 +80,7 @@ final class CurrencyControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.currencies'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } public function testGivenAuthenticatedRequestWhenCallingTheCurrenciesEndpointThenReturns200HttpCode(): void diff --git a/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php b/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php index 051492f6bc..e6a089b7ec 100644 --- a/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php +++ b/tests/integration/Api/Autocomplete/ObjectGroupControllerTest.php @@ -78,7 +78,7 @@ final class ObjectGroupControllerTest extends TestCase $response = $this->get(route('api.v1.autocomplete.object-groups'), ['Accept' => 'application/json']); $response->assertStatus(401); $response->assertHeader('Content-Type', 'application/json'); - $response->assertContent('{"message":"Unauthenticated","exception":"AuthenticationException"}'); + $response->assertContent('{"message":"Unauthenticated.","exception":"AuthenticationException"}'); } public function testGivenAuthenticatedRequestWhenCallingTheObjectGroupsEndpointThenReturns200HttpCode(): void