Skip to content

Firefly III: a personal finances manager

Fix tests

James Colee0c76695eec6
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