Fixed timezone problem in unit tests

This commit is contained in:
Constantin Graf
2024-09-30 10:58:33 +02:00
committed by Constantin Graf
parent 8b50f33cc9
commit 78ea8a673b
4 changed files with 13 additions and 10 deletions

View File

@@ -140,6 +140,7 @@ class TimeEntryAggregationServiceTest extends TestCaseWithDatabase
public function test_aggregate_time_entries_empty_state_by_day_and_project_with_filled_gaps(): void
{
// Arrange
$timezone = 'Europe/Vienna';
$query = TimeEntry::query();
// Act
@@ -147,7 +148,7 @@ class TimeEntryAggregationServiceTest extends TestCaseWithDatabase
$query,
TimeEntryAggregationType::Day,
TimeEntryAggregationType::Project,
'Europe/Vienna',
$timezone,
Weekday::Monday,
true,
Carbon::now()->subDays(2)->utc(),
@@ -161,14 +162,14 @@ class TimeEntryAggregationServiceTest extends TestCaseWithDatabase
'grouped_type' => 'day',
'grouped_data' => [
[
'key' => Carbon::now()->subDays(2)->utc()->format('Y-m-d'),
'key' => Carbon::now()->subDays(2)->timezone($timezone)->format('Y-m-d'),
'seconds' => 0,
'cost' => 0,
'grouped_type' => 'project',
'grouped_data' => [],
],
[
'key' => Carbon::now()->subDay()->utc()->format('Y-m-d'),
'key' => Carbon::now()->subDay()->timezone($timezone)->format('Y-m-d'),
'seconds' => 0,
'cost' => 0,
'grouped_type' => 'project',