From 9142d938ca39799529ce63efea81dd45b350d430 Mon Sep 17 00:00:00 2001 From: Luc Wollants Date: Tue, 20 Aug 2024 13:47:15 +0200 Subject: [PATCH 1/4] Add simple datetime factory class to create time from atom format --- src/DateTimeFactory.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/DateTimeFactory.php diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php new file mode 100644 index 00000000..503be076 --- /dev/null +++ b/src/DateTimeFactory.php @@ -0,0 +1,24 @@ + Date: Tue, 20 Aug 2024 13:47:43 +0200 Subject: [PATCH 2/4] Use the new datetime factory --- .../Properties/AvailabilityTransformer.php | 3 +- .../Properties/CalendarTransformer.php | 5 +- .../ElasticSearchOfferQueryBuilderTest.php | 52 +++++++++---------- tests/Http/OfferSearchControllerTest.php | 33 ++++++------ .../ArrayParameterBagAdapterTest.php | 5 +- 5 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/ElasticSearch/JsonDocument/Properties/AvailabilityTransformer.php b/src/ElasticSearch/JsonDocument/Properties/AvailabilityTransformer.php index b70e918a..d61ab151 100644 --- a/src/ElasticSearch/JsonDocument/Properties/AvailabilityTransformer.php +++ b/src/ElasticSearch/JsonDocument/Properties/AvailabilityTransformer.php @@ -4,6 +4,7 @@ namespace CultuurNet\UDB3\Search\ElasticSearch\JsonDocument\Properties; +use CultuurNet\UDB3\Search\DateTimeFactory; use DateTime; use CultuurNet\UDB3\Search\JsonDocument\JsonTransformer; use CultuurNet\UDB3\Search\JsonDocument\JsonTransformerLogger; @@ -42,7 +43,7 @@ public function transform(array $from, array $draft = []): array // We could also have a half-open availableRange (without end date), but that would not // be consistent with existing permanent offers that do have an availableTo set in 2100. // We also need to set it to 2100-01-01 instead of leaving it open so we can sort on it. - $availableTo = DateTimeImmutable::createFromFormat(DateTime::ATOM, '2100-01-01T00:00:00+00:00'); + $availableTo = DateTimeFactory::fromAtom('2100-01-01T00:00:00+00:00'); } if ($availableFrom > $availableTo) { diff --git a/src/ElasticSearch/JsonDocument/Properties/CalendarTransformer.php b/src/ElasticSearch/JsonDocument/Properties/CalendarTransformer.php index 6a3f7db0..cb0dd88b 100644 --- a/src/ElasticSearch/JsonDocument/Properties/CalendarTransformer.php +++ b/src/ElasticSearch/JsonDocument/Properties/CalendarTransformer.php @@ -5,6 +5,7 @@ namespace CultuurNet\UDB3\Search\ElasticSearch\JsonDocument\Properties; use Cake\Chronos\Chronos; +use CultuurNet\UDB3\Search\DateTimeFactory; use CultuurNet\UDB3\Search\JsonDocument\JsonTransformer; use CultuurNet\UDB3\Search\JsonDocument\JsonTransformerLogger; use DateInterval; @@ -474,13 +475,13 @@ private function convertSubEventToLocalTimeRanges(array $subEvent, DateTimeZone // When converting the dates to times it's important we set the right timezone, because sometimes the dates are // in UTC for example and then the time info is not what we'd expect to be in Belgium. if (isset($subEvent['startDate'])) { - $startDate = DateTimeImmutable::createFromFormat(DateTime::ATOM, $subEvent['startDate']); + $startDate = DateTimeFactory::fromAtom($subEvent['startDate']); $startDate = $startDate->setTimezone($timezone); $startTime = $startDate->format('Hi'); } if (isset($subEvent['endDate'])) { - $endDate = DateTimeImmutable::createFromFormat(DateTime::ATOM, $subEvent['endDate']); + $endDate = DateTimeFactory::fromAtom($subEvent['endDate']); $endDate = $endDate->setTimezone($timezone); $endTime = $endDate->format('Hi'); } diff --git a/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php b/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php index 2fcf7d70..270621cc 100644 --- a/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php +++ b/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php @@ -7,6 +7,7 @@ use CultuurNet\UDB3\Search\Address\PostalCode; use CultuurNet\UDB3\Search\Country; use CultuurNet\UDB3\Search\Creator; +use CultuurNet\UDB3\Search\DateTimeFactory; use CultuurNet\UDB3\Search\ElasticSearch\AbstractElasticSearchQueryBuilderTest; use CultuurNet\UDB3\Search\ElasticSearch\ElasticSearchDistance; use CultuurNet\UDB3\Search\ElasticSearch\LuceneQueryString; @@ -437,8 +438,7 @@ public function it_should_build_a_query_with_a_date_range_filter_without_upper_b $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withDateRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - null + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00') ); $expectedQueryArray = [ @@ -479,7 +479,7 @@ public function it_should_build_a_query_with_a_date_range_filter_without_lower_b ->withStartAndLimit(new Start(30), new Limit(10)) ->withDateRangeFilter( null, - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -519,8 +519,8 @@ public function it_should_build_a_query_with_a_complete_date_range_filter(): voi $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withDateRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -562,8 +562,8 @@ public function it_should_build_query_with_a_complete_date_range_and_time_range_ ->withStartAndLimit(new Start(30), new Limit(10)) ->withSubEventFilter( (new SubEventQueryParameters()) - ->withDateFrom(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00')) - ->withDateTo(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00')) + ->withDateFrom(DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00')) + ->withDateTo(DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00')) ->withLocalTimeFrom(800) ->withLocalTimeTo(1600) ->withStatuses([Status::temporarilyUnavailable(), Status::unavailable()]) @@ -647,8 +647,8 @@ public function it_should_build_query_with_a_complete_date_range_and_time_range_ ->withStartAndLimit(new Start(30), new Limit(10)) ->withSubEventFilter( (new SubEventQueryParameters()) - ->withDateFrom(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00')) - ->withDateTo(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00')) + ->withDateFrom(DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00')) + ->withDateTo(DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00')) ->withLocalTimeFrom(800) ->withLocalTimeTo(1600) ); @@ -711,8 +711,8 @@ public function it_should_build_query_with_a_complete_date_range_filter_for_mult ->withStartAndLimit(new Start(30), new Limit(10)) ->withSubEventFilter( (new SubEventQueryParameters()) - ->withDateFrom(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00')) - ->withDateTo(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00')) + ->withDateFrom(DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00')) + ->withDateTo(DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00')) ->withStatuses([Status::temporarilyUnavailable(), Status::unavailable()]) ); @@ -1225,8 +1225,7 @@ public function it_should_build_a_query_with_an_available_range_filter_without_u $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - null + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), ); $expectedQueryArray = [ @@ -1267,7 +1266,7 @@ public function it_should_build_a_query_with_an_available_range_filter_without_l ->withStartAndLimit(new Start(30), new Limit(10)) ->withAvailableRangeFilter( null, - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -1307,8 +1306,8 @@ public function it_should_build_a_query_with_a_complete_available_range_filter() $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -1353,8 +1352,8 @@ public function it_should_throw_an_exception_for_an_invalid_available_range(): v (new ElasticSearchOfferQueryBuilder()) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00') + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00'), + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00') ); } @@ -2852,8 +2851,7 @@ public function it_should_build_a_query_with_a_created_range_filter_without_uppe $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withCreatedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - null + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), ); $expectedQueryArray = [ @@ -2894,7 +2892,7 @@ public function it_should_build_a_query_with_a_created_range_filter_without_lowe ->withStartAndLimit(new Start(30), new Limit(10)) ->withCreatedRangeFilter( null, - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -2934,8 +2932,8 @@ public function it_should_build_a_query_with_a_complete_created_range_filter(): $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withCreatedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -2976,7 +2974,7 @@ public function it_should_build_a_query_with_a_modified_range_filter_without_upp $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withModifiedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), null ); @@ -3018,7 +3016,7 @@ public function it_should_build_a_query_with_a_modified_range_filter_without_low ->withStartAndLimit(new Start(30), new Limit(10)) ->withModifiedRangeFilter( null, - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ @@ -3058,8 +3056,8 @@ public function it_should_build_a_query_with_a_complete_modified_range_filter(): $builder = (new ElasticSearchOfferQueryBuilder()) ->withStartAndLimit(new Start(30), new Limit(10)) ->withModifiedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-25T00:00:00+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+00:00') + DateTimeFactory::fromAtom('2017-04-25T00:00:00+00:00'), + DateTimeFactory::fromAtom('2017-05-01T23:59:59+00:00') ); $expectedQueryArray = [ diff --git a/tests/Http/OfferSearchControllerTest.php b/tests/Http/OfferSearchControllerTest.php index 4525e6c7..ebbc9cf4 100644 --- a/tests/Http/OfferSearchControllerTest.php +++ b/tests/Http/OfferSearchControllerTest.php @@ -4,6 +4,7 @@ namespace CultuurNet\UDB3\Search\Http; +use CultuurNet\UDB3\Search\DateTimeFactory; use InvalidArgumentException; use CultuurNet\UDB3\Search\Address\PostalCode; use CultuurNet\UDB3\Search\Country; @@ -249,8 +250,8 @@ public function it_returns_a_paged_collection_of_search_results_based_on_request new WorkflowStatus('DRAFT') ) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-26T00:00:00+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-28T15:30:23+01:00') + DateTimeFactory::fromAtom('2017-04-26T00:00:00+01:00'), + DateTimeFactory::fromAtom('2017-04-28T15:30:23+01:00') ) ->withRegionFilter( $this->regionIndexName, @@ -271,18 +272,18 @@ public function it_returns_a_paged_collection_of_search_results_based_on_request ->withUiTPASFilter(true) ->withCreatorFilter(new Creator('Jane Doe')) ->withCreatedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T13:33:37+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T13:33:37+01:00') + DateTimeFactory::fromAtom('2017-05-01T13:33:37+01:00'), + DateTimeFactory::fromAtom('2017-05-01T13:33:37+01:00') ) ->withModifiedRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T13:33:37+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T13:33:37+01:00') + DateTimeFactory::fromAtom('2017-05-01T13:33:37+01:00'), + DateTimeFactory::fromAtom('2017-05-01T13:33:37+01:00') ) ->withCalendarTypeFilter(new CalendarType('single')) ->withSubEventFilter( (new SubEventQueryParameters()) - ->withDateFrom(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T00:00:00+01:00')) - ->withDateTo(DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+01:00')) + ->withDateFrom(DateTimeFactory::fromAtom('2017-05-01T00:00:00+01:00')) + ->withDateTo(DateTimeFactory::fromAtom('2017-05-01T23:59:59+01:00')) ->withLocalTimeFrom(800) ->withLocalTimeTo(1600) ->withStatuses([Status::unavailable(), Status::temporarilyUnavailable()]) @@ -486,8 +487,8 @@ public function it_uses_default_parameters_when_default_filters_are_not_disabled $expectedQueryBuilder = $this->queryBuilder ->withWorkflowStatusFilter(new WorkflowStatus('APPROVED'), new WorkflowStatus('READY_FOR_VALIDATION')) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-26T08:34:21+00:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-26T08:34:21+00:00') + DateTimeFactory::fromAtom('2017-04-26T08:34:21+00:00'), + DateTimeFactory::fromAtom('2017-04-26T08:34:21+00:00') ) ->withAddressCountryFilter(new Country('BE')) ->withAudienceTypeFilter(new AudienceType('everyone')) @@ -576,12 +577,12 @@ public function it_can_convert_spaces_in_date_parameters_to_plus_signs(): void $expectedQueryBuilder = $this->queryBuilder ->withStartAndLimit(new Start(30), new Limit(10)) ->withAvailableRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-01T00:00:00+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-01T23:59:59+01:00') + DateTimeFactory::fromAtom('2017-04-01T00:00:00+01:00'), + DateTimeFactory::fromAtom('2017-04-01T23:59:59+01:00') ) ->withDateRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-01T00:00:00+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-01T23:59:59+01:00') + DateTimeFactory::fromAtom('2017-04-01T00:00:00+01:00'), + DateTimeFactory::fromAtom('2017-04-01T23:59:59+01:00') ); $expectedResultSet = new PagedResultSet(30, 0, []); @@ -1089,8 +1090,8 @@ public function it_uses_a_date_range_filter_only_if_no_status_or_time_from_or_ti $expectedQueryBuilder = $this->queryBuilder ->withDateRangeFilter( - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T00:00:00+01:00'), - DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-05-01T23:59:59+01:00') + DateTimeFactory::fromAtom('2017-05-01T00:00:00+01:00'), + DateTimeFactory::fromAtom('2017-05-01T23:59:59+01:00') ); $expectedResultSet = new PagedResultSet(30, 0, []); diff --git a/tests/Http/Parameters/ArrayParameterBagAdapterTest.php b/tests/Http/Parameters/ArrayParameterBagAdapterTest.php index 63c2039f..d6a72876 100644 --- a/tests/Http/Parameters/ArrayParameterBagAdapterTest.php +++ b/tests/Http/Parameters/ArrayParameterBagAdapterTest.php @@ -4,6 +4,7 @@ namespace CultuurNet\UDB3\Search\Http\Parameters; +use CultuurNet\UDB3\Search\DateTimeFactory; use CultuurNet\UDB3\Search\Label\LabelName; use CultuurNet\UDB3\Search\Offer\WorkflowStatus; use DateTime; @@ -431,7 +432,7 @@ public function it_should_parse_a_datetime_from_a_parameter(): void { $parameterBag = new ArrayParameterBagAdapter(['availableFrom' => '2017-04-26T12:20:05+01:00']); - $expected = DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-26T12:20:05+01:00'); + $expected = DateTimeFactory::fromAtom('2017-04-26T12:20:05+01:00'); $actual = $parameterBag->getDateTimeFromParameter('availableFrom'); $this->assertDateTimeEquals($expected, $actual); @@ -448,7 +449,7 @@ public function it_should_return_a_default_for_a_datetime_parameter_if_it_is_emp $parameterBag = new ArrayParameterBagAdapter([]); $default = '2017-04-26T12:20:05+01:00'; - $expected = DateTimeImmutable::createFromFormat(DateTime::ATOM, '2017-04-26T12:20:05+01:00'); + $expected = DateTimeFactory::fromAtom('2017-04-26T12:20:05+01:00'); $actual = $parameterBag->getDateTimeFromParameter('availableFrom', $default); $this->assertDateTimeEquals($expected, $actual); From 5eaa54e4f32452f1fca0846978d3625a211c3727 Mon Sep 17 00:00:00 2001 From: Luc Wollants Date: Tue, 20 Aug 2024 13:48:20 +0200 Subject: [PATCH 3/4] Handle possible false return type --- .../RequestParser/AvailabilityOfferRequestParser.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Http/Offer/RequestParser/AvailabilityOfferRequestParser.php b/src/Http/Offer/RequestParser/AvailabilityOfferRequestParser.php index 2cc9a49a..83001fda 100644 --- a/src/Http/Offer/RequestParser/AvailabilityOfferRequestParser.php +++ b/src/Http/Offer/RequestParser/AvailabilityOfferRequestParser.php @@ -7,6 +7,7 @@ use CultuurNet\UDB3\Search\Http\ApiRequestInterface; use CultuurNet\UDB3\Search\Offer\OfferQueryBuilderInterface; use DateTimeImmutable; +use InvalidArgumentException; final class AvailabilityOfferRequestParser implements OfferRequestParserInterface { @@ -14,8 +15,11 @@ public function parse(ApiRequestInterface $request, OfferQueryBuilderInterface $ { $parameterBagReader = $request->getQueryParameterBag(); - $default = DateTimeImmutable::createFromFormat('U', (string) $request->getServerParam('REQUEST_TIME', 0)) - ->format(DATE_ATOM); + $default = DateTimeImmutable::createFromFormat('U', (string) $request->getServerParam('REQUEST_TIME', 0)); + if (!$default) { + throw new InvalidArgumentException('Invalid timestamp provided'); + } + $default = $default->format(DATE_ATOM); $availableFrom = $parameterBagReader->getDateTimeFromParameter('availableFrom', $default); $availableTo = $parameterBagReader->getDateTimeFromParameter('availableTo', $default); From 48770948dab73fa436da8e46a3936c007788cbd8 Mon Sep 17 00:00:00 2001 From: Luc Wollants Date: Tue, 20 Aug 2024 13:50:50 +0200 Subject: [PATCH 4/4] Linting --- src/DateTimeFactory.php | 2 +- .../ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php | 2 -- tests/Http/OfferSearchControllerTest.php | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index 503be076..894fc7cb 100644 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -21,4 +21,4 @@ public static function fromAtom(string $datetime): DateTimeImmutable throw new InvalidArgumentException($datetime . ' does not appear to be a valid ' . $format . ' datetime string.'); } -} \ No newline at end of file +} diff --git a/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php b/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php index 270621cc..5974ad04 100644 --- a/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php +++ b/tests/ElasticSearch/Offer/ElasticSearchOfferQueryBuilderTest.php @@ -35,8 +35,6 @@ use CultuurNet\UDB3\Search\SortOrder; use CultuurNet\UDB3\Search\Start; use CultuurNet\UDB3\Search\UnsupportedParameterValue; -use DateTime; -use DateTimeImmutable; use InvalidArgumentException; final class ElasticSearchOfferQueryBuilderTest extends AbstractElasticSearchQueryBuilderTest diff --git a/tests/Http/OfferSearchControllerTest.php b/tests/Http/OfferSearchControllerTest.php index ebbc9cf4..705cac1a 100644 --- a/tests/Http/OfferSearchControllerTest.php +++ b/tests/Http/OfferSearchControllerTest.php @@ -53,8 +53,6 @@ use CultuurNet\UDB3\Search\Region\RegionId; use CultuurNet\UDB3\Search\SortOrder; use CultuurNet\UDB3\Search\Start; -use DateTime; -use DateTimeImmutable; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ServerRequestInterface;