From 0543849370bd53c40cb8b17152d2f1fb6576f2a8 Mon Sep 17 00:00:00 2001 From: Holger Veltrup Date: Mon, 13 May 2024 14:32:03 +0200 Subject: [PATCH] test: set timezone --- test/Service/Indexer/IndexerStatusStoreTest.php | 3 +++ .../Service/Search/SolrQueryFilterAppenderTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/Service/Indexer/IndexerStatusStoreTest.php b/test/Service/Indexer/IndexerStatusStoreTest.php index 18badf8..42fb8d1 100644 --- a/test/Service/Indexer/IndexerStatusStoreTest.php +++ b/test/Service/Indexer/IndexerStatusStoreTest.php @@ -187,14 +187,17 @@ private function createIndexerStatus(): IndexerStatus { $startTime = new \DateTime(); + $startTime->setTimezone(new \DateTimeZone('UTC')); $startTime->setDate(2024, 1, 31); $startTime->setTime(11, 15, 10); $endTime = new \DateTime(); + $endTime->setTimezone(new \DateTimeZone('UTC')); $endTime->setDate(2024, 1, 31); $endTime->setTime(12, 16, 11); $lastUpdate = new \DateTime(); + $lastUpdate->setTimezone(new \DateTimeZone('UTC')); $lastUpdate->setDate(2024, 1, 31); $lastUpdate->setTime(13, 17, 12); diff --git a/test/Service/Search/SolrQueryFilterAppenderTest.php b/test/Service/Search/SolrQueryFilterAppenderTest.php index 8be3531..c9ae1d0 100644 --- a/test/Service/Search/SolrQueryFilterAppenderTest.php +++ b/test/Service/Search/SolrQueryFilterAppenderTest.php @@ -132,8 +132,8 @@ public function testQueryFilter(): void public function testAbsoluteDateRangeFilterWithFromAndTo(): void { - $from = new \DateTime('2021-01-01 00:00:00'); - $to = new \DateTime('2021-01-02 00:00:00'); + $from = new \DateTime('2021-01-01 00:00:00Z'); + $to = new \DateTime('2021-01-02 00:00:00Z'); $filter = new AbsoluteDateRangeFilter($from, $to, 'sp_date_list'); $this->filterQuery->expects($this->once()) @@ -145,7 +145,7 @@ public function testAbsoluteDateRangeFilterWithFromAndTo(): void public function testAbsoluteDateRangeFilterWithFrom(): void { - $from = new \DateTime('2021-01-01 00:00:00'); + $from = new \DateTime('2021-01-01 00:00:00Z'); $filter = new AbsoluteDateRangeFilter($from, null, 'sp_date_list'); $this->filterQuery->expects($this->once()) @@ -157,7 +157,7 @@ public function testAbsoluteDateRangeFilterWithFrom(): void public function testAbsoluteDateRangeFilterWithTo(): void { - $to = new \DateTime('2021-01-02 00:00:00'); + $to = new \DateTime('2021-01-02 00:00:00Z'); $filter = new AbsoluteDateRangeFilter(null, $to, 'sp_date_list'); $this->filterQuery->expects($this->once()) @@ -219,21 +219,21 @@ public static function additionProviderWithBase(): array { return [ [ - new DateTime('2021-01-01 00:00:00'), + new DateTime('2021-01-01 00:00:00Z'), 'P1D', null, 'test:[2021-01-01T00:00:00Z-1DAYS/DAY' . ' TO 2021-01-01T00:00:00Z/DAY+1DAY-1SECOND]' ], [ - new DateTime('2021-01-01 00:00:00'), + new DateTime('2021-01-01 00:00:00Z'), null, 'P2M', 'test:[2021-01-01T00:00:00Z/DAY' . ' TO 2021-01-01T00:00:00Z+2MONTHS/DAY+1DAY-1SECOND]' ], [ - new DateTime('2021-01-01 00:00:00'), + new DateTime('2021-01-01 00:00:00Z'), 'P1W', 'P2M', 'test:[2021-01-01T00:00:00Z-7DAYS/DAY' .