From a07c16b7230868c7ba751d9c84e8921ca17bf676 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 4 Nov 2024 14:30:18 +0100 Subject: [PATCH] Migrate TypoScript import settings Those are now part of the import, or hard coded. Resolves: #11483 --- Classes/Domain/Model/Import.php | 36 ++++++++-- .../Service/DestinationDataImportService.php | 2 +- .../ArrayBasedConfigurationService.php | 43 ------------ .../ConfigurationServiceInterface.php | 15 ----- .../DatesFactory.php | 26 ++++---- .../ExtbaseConfigurationService.php | 66 ------------------- .../UrlFactory.php | 19 ++---- Configuration/Services.yaml | 3 - .../TCA/tx_events_domain_model_import.php | 53 +++++++++++++++ Configuration/TypoScript/constants.typoscript | 18 ----- Configuration/TypoScript/setup.typoscript | 11 ---- Documentation/Changelog/5.0.0.rst | 11 ++++ .../Private/Language/locallang_csh_import.xlf | 28 +++++++- .../Functional/AbstractFunctionalTestCase.php | 16 ----- Tests/Functional/Frontend/CacheTest.php | 8 --- .../Database/DefaultImportConfiguration.php | 3 + .../Database/FeaturesImportConfiguration.php | 4 ++ ...ateOfRecurringDatesImportConfiguration.php | 4 ++ .../Database/ImportConfigurationWithHtml.php | 3 + .../Database/MinimalImportConfiguration.php | 3 + .../Database/SecondImportConfiguration.php | 3 + .../Database/SingleImportConfiguration.php | 3 + ...ingleImportConfigurationWithCategories.php | 3 + ...SingleImportConfigurationWithoutRegion.php | 3 + .../ImportCleansTransientFilesTest.php | 10 +-- .../ImportDoesNotUseUploadsFolderTest.php | 10 +-- ...ImportDoesntBreakWithLongFileTitleTest.php | 8 --- ...rtDoesntEndUpInEndlessDateCreationTest.php | 8 --- .../ImportHandlesImagesTest.php | 8 --- .../ImportHandlesPricesTest.php | 8 --- .../ImportsAllConfigurationTest.php | 12 +--- .../ImportsExampleAsExpectedTest.php | 16 +---- .../ImportsFeaturesTest.php | 6 -- .../ImportsFirstDateOfDatesTest.php | 3 - .../ImportsSingleConfigurationTest.php | 10 +-- .../DestinationDataTest/ImportsTextsTest.php | 14 ---- .../ImportsTicketsTest.php | 10 +-- .../ImportsWithConfiguredRepeatUntilTest.php | 26 +++++--- .../ImportsWithLocationsTest.php | 8 --- ...mportsWithSystemConfiguredTimeZoneTest.php | 3 - ...mportsWithoutCategoryIfNotProvidedTest.php | 14 ---- .../ImportsWithoutLocationTest.php | 8 --- .../ImportsWithoutRegionIfNotProvidedTest.php | 14 ---- .../CategoriesAssignEventTest.php | 9 --- .../EventImportEventTest.php | 9 --- ...HandlerCanKeepCustomCategoriesAssigned.php | 3 + .../RegisteredEventHandlerCanModifyEvent.php | 3 + Tests/Unit/Domain/Model/ImportTest.php | 32 +++++++-- .../DatesFactoryTest.php | 25 +++---- .../UrlFactoryTest.php | 63 +++++------------- ext_tables.sql | 4 ++ 51 files changed, 260 insertions(+), 468 deletions(-) delete mode 100644 Classes/Service/DestinationDataImportService/ArrayBasedConfigurationService.php delete mode 100644 Classes/Service/DestinationDataImportService/ConfigurationServiceInterface.php delete mode 100644 Classes/Service/DestinationDataImportService/ExtbaseConfigurationService.php diff --git a/Classes/Domain/Model/Import.php b/Classes/Domain/Model/Import.php index 1ae05b2..1b609ff 100644 --- a/Classes/Domain/Model/Import.php +++ b/Classes/Domain/Model/Import.php @@ -21,13 +21,17 @@ class Import extends AbstractDomainObject public function __construct( protected Folder $filesFolder, protected int $storagePid, + protected string $restLicenseKey, protected string $restExperience, + protected string $restMode = 'next_months,12', + protected int $restLimit = 500, protected string $restSearchQuery = '', int $categoriesPid = 0, protected ?Category $categoryParent = null, int $featuresPid = 0, protected ?Category $featuresParent = null, protected ?Region $region = null, + protected string $importRepeatUntil = '+60 days', protected int $importFeatures = 0, ) { // Do not allow categories on pid 0 @@ -78,18 +82,38 @@ class Import extends AbstractDomainObject return $this->region; } + public function getFeatures(): Features + { + return new Features($this->importFeatures); + } + + public function getRepeatUntil(): string + { + return $this->importRepeatUntil; + } + + public function getRestLicenseKey(): string + { + return $this->restLicenseKey; + } + public function getRestExperience(): string { return $this->restExperience; } - public function getSearchQuery(): string + public function getRestMode(): string + { + return $this->restMode; + } + + public function getRestLimit(): int + { + return (int)$this->restLimit; + } + + public function getRestSearchQuery(): string { return $this->restSearchQuery; } - - public function getFeatures(): Features - { - return new Features($this->importFeatures); - } } diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index edf57a0..366077f 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -254,7 +254,7 @@ final class DestinationDataImportService $this->dateRepository->remove($currentDate); } - $dates = $this->datesFactory->createDates($timeIntervals, $canceled); + $dates = $this->datesFactory->createDates($this->import, $timeIntervals, $canceled); foreach ($dates as $date) { $this->tmpCurrentEvent->addDate($date); } diff --git a/Classes/Service/DestinationDataImportService/ArrayBasedConfigurationService.php b/Classes/Service/DestinationDataImportService/ArrayBasedConfigurationService.php deleted file mode 100644 index 35dc4cc..0000000 --- a/Classes/Service/DestinationDataImportService/ArrayBasedConfigurationService.php +++ /dev/null @@ -1,43 +0,0 @@ -settings['license'] ?? ''; - } - - public function getRestType(): string - { - return $this->settings['restType'] ?? ''; - } - - public function getRestMode(): string - { - return $this->settings['restMode'] ?? ''; - } - - public function getRestLimit(): string - { - return $this->settings['restLimit'] ?? ''; - } - - public function getRestTemplate(): string - { - return $this->settings['restTemplate'] ?? ''; - } - - public function getRestUrl(): string - { - return $this->settings['restUrl'] ?? ''; - } -} diff --git a/Classes/Service/DestinationDataImportService/ConfigurationServiceInterface.php b/Classes/Service/DestinationDataImportService/ConfigurationServiceInterface.php deleted file mode 100644 index 6724bbe..0000000 --- a/Classes/Service/DestinationDataImportService/ConfigurationServiceInterface.php +++ /dev/null @@ -1,15 +0,0 @@ -logger = $logManager->getLogger(self::class); @@ -31,11 +30,12 @@ final class DatesFactory * @return Generator */ public function createDates( + Import $import, array $timeIntervals, bool $canceled ): Generator { foreach ($timeIntervals as $date) { - $dates = $this->createDate($date, $canceled); + $dates = $this->createDate($import, $date, $canceled); if (!$dates instanceof Generator) { return null; } @@ -50,6 +50,7 @@ final class DatesFactory * @return Generator|null */ private function createDate( + Import $import, array $date, bool $canceled ): ?Generator { @@ -60,7 +61,7 @@ final class DatesFactory if ($this->isDateInterval($date)) { $this->logger->info('Is interval date', ['date' => $date]); - return $this->createDateFromInterval($date, $canceled); + return $this->createDateFromInterval($import, $date, $canceled); } return null; @@ -106,10 +107,11 @@ final class DatesFactory * @return Generator|null */ private function createDateFromInterval( + Import $import, array $date, bool $canceled ): ?Generator { - $date = $this->ensureRepeatUntil($date); + $date = $this->ensureRepeatUntil($import, $date); if ($date['freq'] == 'Daily') { return $this->createDailyDates($date, $canceled); @@ -122,19 +124,15 @@ final class DatesFactory return null; } - private function ensureRepeatUntil(array $date): array - { + private function ensureRepeatUntil( + Import $import, + array $date + ): array { if (empty($date['repeatUntil']) === false) { return $date; } - $settings = $this->configurationManager->getConfiguration( - ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, - 'Events', - 'Import' - ); - $configuredModification = $settings['repeatUntil'] ?? '+60 days'; - $date['repeatUntil'] = $this->getToday()->modify($configuredModification)->format('c'); + $date['repeatUntil'] = $this->getToday()->modify($import->getRepeatUntil())->format('c'); $this->logger->info('Interval did not provide repeatUntil.', ['newRepeat' => $date['repeatUntil']]); return $date; diff --git a/Classes/Service/DestinationDataImportService/ExtbaseConfigurationService.php b/Classes/Service/DestinationDataImportService/ExtbaseConfigurationService.php deleted file mode 100644 index 44b7e65..0000000 --- a/Classes/Service/DestinationDataImportService/ExtbaseConfigurationService.php +++ /dev/null @@ -1,66 +0,0 @@ -getSettings()['license'] ?? ''; - } - - public function getRestType(): string - { - return $this->getSettings()['restType'] ?? ''; - } - - public function getRestMode(): string - { - return $this->getSettings()['restMode'] ?? ''; - } - - public function getRestLimit(): string - { - return $this->getSettings()['restLimit'] ?? ''; - } - - public function getRestTemplate(): string - { - return $this->getSettings()['restTemplate'] ?? ''; - } - - public function getRestUrl(): string - { - return $this->getSettings()['restUrl'] ?? ''; - } - - private function getSettings(): array - { - if ($this->settings !== []) { - return $this->settings; - } - - $fullTypoScript = $this->configurationManager - ->getInstanceWithBackendContext() - ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT) - ; - - $this->settings = $fullTypoScript['module.']['tx_events.']['settings.']['destinationData.'] - ?? $fullTypoScript['module.']['tx_events_pi1.']['settings.']['destinationData.'] - ?? []; - - return $this->settings; - } -} diff --git a/Classes/Service/DestinationDataImportService/UrlFactory.php b/Classes/Service/DestinationDataImportService/UrlFactory.php index 9c1bd56..2e320d7 100644 --- a/Classes/Service/DestinationDataImportService/UrlFactory.php +++ b/Classes/Service/DestinationDataImportService/UrlFactory.php @@ -12,11 +12,6 @@ use WerkraumMedia\Events\Domain\Model\Import; */ final class UrlFactory { - public function __construct( - private readonly ConfigurationServiceInterface $configuration, - ) { - } - /** * URL used to fetch initial set of data. */ @@ -25,17 +20,17 @@ final class UrlFactory ): string { $parameter = [ 'experience' => $import->getRestExperience(), - 'licensekey' => $this->configuration->getLicenseKey(), - 'type' => $this->configuration->getRestType(), - 'mode' => $this->configuration->getRestMode(), - 'limit' => $this->configuration->getRestLimit(), - 'template' => $this->configuration->getRestTemplate(), - 'q' => $import->getSearchQuery(), + 'licensekey' => $import->getRestLicenseKey(), + 'type' => 'Event', + 'mode' => $import->getRestMode(), + 'limit' => $import->getRestLimit(), + 'template' => 'ET2014A.json', + 'q' => $import->getRestSearchQuery(), ]; $parameter = array_filter($parameter); - $url = new Uri($this->configuration->getRestUrl()); + $url = new Uri('http://meta.et4.de/rest.ashx/search/'); $url = $url->withQuery(http_build_query($parameter)); return (string)$url; } diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index cf06b5a..4a68e09 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -43,9 +43,6 @@ services: WerkraumMedia\Events\Updates\MigrateOldLocations: public: true - WerkraumMedia\Events\Service\DestinationDataImportService\ConfigurationServiceInterface: - alias: 'WerkraumMedia\Events\Service\DestinationDataImportService\ExtbaseConfigurationService' - WerkraumMedia\Events\Caching\PageCacheTimeout: arguments: '$runtimeCache': '@cache.runtime' diff --git a/Configuration/TCA/tx_events_domain_model_import.php b/Configuration/TCA/tx_events_domain_model_import.php index 5bdbd15..ff364f2 100644 --- a/Configuration/TCA/tx_events_domain_model_import.php +++ b/Configuration/TCA/tx_events_domain_model_import.php @@ -28,9 +28,13 @@ return [ '--palette--;;features', '--palette--;;relations', '--div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.rest', + 'rest_license_key', 'rest_experience', + 'rest_mode', + 'rest_limit', 'rest_search_query', '--div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.import', + 'import_repeat_until', 'import_features', ]), ], @@ -162,16 +166,53 @@ return [ ], ], + 'rest_license_key' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_license_key', + 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_license_key.description', + 'config' => [ + 'type' => 'input', + 'size' => 50, + ], + ], 'rest_experience' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_experience', 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_experience.description', 'config' => [ 'type' => 'input', + 'required' => true, 'size' => 50, 'max' => 255, ], ], + 'rest_mode' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_mode', + 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_mode.description', + 'config' => [ + 'type' => 'input', + 'default' => 'next_months,12', + 'size' => 50, + 'max' => 255, + ], + ], + 'rest_limit' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_limit', + 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_limit.description', + 'config' => [ + 'type' => 'number', + 'format' => 'integer', + 'default' => '500', + 'size' => 50, + 'required' => true, + 'range' => [ + 'lower' => 0, + 'upper' => 5000, + ], + ], + ], 'rest_search_query' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.rest_search_query', @@ -181,6 +222,18 @@ return [ 'size' => 50, ], ], + + 'import_repeat_until' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_repeat_until', + 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_repeat_until.description', + 'config' => [ + 'type' => 'input', + 'default' => '+60 days', + 'size' => 50, + 'max' => 255, + ], + ], 'import_features' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_features', diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 61310cd..ff95265 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -15,23 +15,5 @@ plugin.tx_events { settings { # cat=plugin.tx_events//a; type=string; label=Default Image defaultImagePath = EXT:events/Resources/Public/Images/default.jpg - destinationData { - # cat=plugin.tx_events//a; type=string; label=Rest Url - restUrl = http://meta.et4.de/rest.ashx/search/ - # cat=plugin.tx_events//a; type=string; label=License - license = - # cat=plugin.tx_events//a; type=string; label=Data Type - restType = Event - # cat=plugin.tx_events//a; type=string; label=Data Limit - restLimit = 500 - # cat=plugin.tx_events//a; type=string; label=Mode - restMode = next_months,12 - # cat=plugin.tx_events//a; type=string; label=Data Template - restTemplate = ET2014A.json - # cat=plugin.tx_events//a; type=string; Label=Category Storage - categoriesPid = 54 - # cat=plugin.tx_events//a; type=string; Label=Category Parent ID - categoryParentUid = 6 - } } } diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 718f6d0..c49aa50 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -42,17 +42,6 @@ plugin.tx_events { maximumNumberOfLinks = 10 } - destinationData { - restUrl = {$plugin.tx_events.settings.destinationData.restUrl} - license = {$plugin.tx_events.settings.destinationData.license} - restType = {$plugin.tx_events.settings.destinationData.restType} - restLimit = {$plugin.tx_events.settings.destinationData.restLimit} - restMode = {$plugin.tx_events.settings.destinationData.restMode} - restTemplate = {$plugin.tx_events.settings.destinationData.restTemplate} - categoriesPid = {$plugin.tx_events.settings.destinationData.categoriesPid} - categoryParentUid = {$plugin.tx_events.settings.destinationData.categoryParentUid} - } - dataProcessing { WerkraumMedia\Events\Domain\Model\Event { 10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor diff --git a/Documentation/Changelog/5.0.0.rst b/Documentation/Changelog/5.0.0.rst index 4df4b54..79c257f 100644 --- a/Documentation/Changelog/5.0.0.rst +++ b/Documentation/Changelog/5.0.0.rst @@ -14,12 +14,23 @@ Breaking We recommend not to use the provided plugins but build your own tailored content elements instead. +* Remaining TypoScript constants for import were moved. + + Those are now part of the import configuration record. + The previous default values will be inserted. + Make sure to update the existing records to include the necessary values. + + Some value are now hard coded as we do not support other values anyway. + + This also affects the `repeatUntil` TypoScript setting which is now moved to the import configuration. + Features -------- * Add Support for TYPO3 v13.4 LTS. * Support large rest search queries. + The field no longer has a limitation. The field is now stored as text instead of varchar. diff --git a/Resources/Private/Language/locallang_csh_import.xlf b/Resources/Private/Language/locallang_csh_import.xlf index ca9ba97..d54d982 100644 --- a/Resources/Private/Language/locallang_csh_import.xlf +++ b/Resources/Private/Language/locallang_csh_import.xlf @@ -72,17 +72,41 @@ TYPO3 folder to use for storing imported files. + + License Key + + + See: https://developer.et4.de/reference/current/#eT4META-search-param-licensekey.html + Experience - See: https://developer.et4.de/reference/current/#eT4META-search-param-experience.html (todo check, was not loadable) + See: https://developer.et4.de/reference/current/#eT4META-search-param-experience.html + + + Mode + + + See: https://developer.et4.de/reference/current/#eT4META-search-param-mode.html + + + Limit + + + See: https://developer.et4.de/reference/current/#eT4META-search-param-limit.html Search Query - See: https://developer.et4.de/reference/current/#eT4META-search-param-q.html (todo check, was not loadable) + See: https://developer.et4.de/reference/current/#eT4META-search-param-q.html + + + Repeat events until + + + Some events will repeat. This will define how many dates will be created. See: https://www.php.net/manual/en/datetimeimmutable.modify.php Import Features diff --git a/Tests/Functional/AbstractFunctionalTestCase.php b/Tests/Functional/AbstractFunctionalTestCase.php index 92d57b0..bbe3bf8 100644 --- a/Tests/Functional/AbstractFunctionalTestCase.php +++ b/Tests/Functional/AbstractFunctionalTestCase.php @@ -114,22 +114,6 @@ abstract class AbstractFunctionalTestCase extends FunctionalTestCase return new TypoScriptInstruction(); } - protected function setUpConfiguration( - array $destinationDataSettings, - array $importSettings = [] - ): void { - $this->setUpFrontendRootPage(1, [], [ - 'config' => implode(PHP_EOL, [ - 'module.tx_events_pi1.settings.destinationData {', - implode(PHP_EOL, $destinationDataSettings), - '}', - 'module.tx_events_import.settings {', - implode(PHP_EOL, $importSettings), - '}', - ]), - ]); - } - protected function &setUpResponses(array $responses): array { $requests = []; diff --git a/Tests/Functional/Frontend/CacheTest.php b/Tests/Functional/Frontend/CacheTest.php index c9a634d..1f1bd1c 100644 --- a/Tests/Functional/Frontend/CacheTest.php +++ b/Tests/Functional/Frontend/CacheTest.php @@ -269,14 +269,6 @@ class CacheTest extends AbstractFunctionalTestCase // Import $this->importPHPDataSet(__DIR__ . '/../Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/../Import/DestinationDataTest/Fixtures/ResponseWithSingleImageForSingleEvent.json') ?: ''), new Response(200, [], file_get_contents(__DIR__ . '/../Import/DestinationDataTest/Fixtures/ExampleImage.jpg') ?: ''), diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php index 77fbfc5..ce356b6 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php @@ -12,6 +12,9 @@ return [ 'files_folder' => '1:/staedte/beispielstadt/events/', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], ]; diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FeaturesImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FeaturesImportConfiguration.php index 4e22a76..3f7c2f3 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FeaturesImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FeaturesImportConfiguration.php @@ -12,6 +12,10 @@ return [ 'features_pid' => '3', 'features_parent' => '4', 'files_folder' => '1:/staedte/beispielstadt/events/', + 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], 'pages' => [ diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php index 7ad2dd2..a91cec3 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php @@ -10,6 +10,10 @@ return [ 'title' => 'Example for test', 'storage_pid' => '2', 'files_folder' => '1:/staedte/beispielstadt/events/', + 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], 'pages' => [ diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportConfigurationWithHtml.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportConfigurationWithHtml.php index 0d93c0c..862bc73 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportConfigurationWithHtml.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportConfigurationWithHtml.php @@ -12,6 +12,9 @@ return [ 'files_folder' => '1:/staedte/beispielstadt/events/', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', 'import_features' => '1', ], ], diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/MinimalImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/MinimalImportConfiguration.php index 1af5812..9664209 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/MinimalImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/MinimalImportConfiguration.php @@ -10,6 +10,9 @@ return [ 'title' => 'Example import configuration', 'storage_pid' => '2', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', 'files_folder' => '1:/staedte/beispielstadt/events/', ], ], diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SecondImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SecondImportConfiguration.php index 124ee4b..d1409d2 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SecondImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SecondImportConfiguration.php @@ -14,6 +14,9 @@ return [ 'category_parent' => '2', 'region' => '1', 'rest_experience' => 'anderestadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', 'rest_search_query' => 'name:"Beispiel2"', ], ], diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfiguration.php index de61577..757460b 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfiguration.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfiguration.php @@ -14,6 +14,9 @@ return [ 'category_parent' => '2', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', 'rest_search_query' => 'name:"Beispiel"', ], ], diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithCategories.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithCategories.php index b078434..3656ee4 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithCategories.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithCategories.php @@ -14,6 +14,9 @@ return [ 'category_parent' => '2', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], ]; diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithoutRegion.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithoutRegion.php index 807c207..4e22f76 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithoutRegion.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/SingleImportConfigurationWithoutRegion.php @@ -11,6 +11,9 @@ return [ 'storage_pid' => '2', 'files_folder' => '1:/staedte/beispielstadt/events/', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], ]; diff --git a/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php index 6111188..a824290 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php @@ -17,14 +17,6 @@ class ImportCleansTransientFilesTest extends AbstractTestCase public function cleansTransientFiles(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -38,7 +30,7 @@ class ImportCleansTransientFilesTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php index adadee0..a55fea3 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php @@ -17,14 +17,6 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTestCase public function doesNotUseUploadsFolder(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -37,7 +29,7 @@ class ImportDoesNotUseUploadsFolderTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php index 2a78075..512baa8 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php @@ -15,14 +15,6 @@ class ImportDoesntBreakWithLongFileTitleTest extends AbstractTestCase $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithVeryLongFileName.json') ?: ''), diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php index 0b69e67..455617e 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php @@ -17,14 +17,6 @@ class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTestCase $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithPotentiellyEndlessDateCreation.json') ?: ''), diff --git a/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php index aa0875c..b39de3d 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php @@ -21,14 +21,6 @@ class ImportHandlesImagesTest extends AbstractTestCase parent::setUp(); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); } #[Test] diff --git a/Tests/Functional/Import/DestinationDataTest/ImportHandlesPricesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportHandlesPricesTest.php index 046edc6..8256c9c 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportHandlesPricesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportHandlesPricesTest.php @@ -17,14 +17,6 @@ class ImportHandlesPricesTest extends AbstractTestCase parent::setUp(); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); } #[Test] diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php index b1b5326..47b07dd 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php @@ -28,14 +28,6 @@ class ImportsAllConfigurationTest extends AbstractTestCase $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SecondImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restTemplate = ET2014A.json', - 'restLimit = 3', - 'restMode = next_months,12', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -54,12 +46,12 @@ class ImportsAllConfigurationTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(8, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel%22', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel%22', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); - self::assertSame('https://example.com/some-path/?experience=anderestadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel2%22', (string)$requests[4]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel%22', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[5]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[6]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[7]['request']->getUri()); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php index 7b89bfd..5871c3d 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php @@ -14,20 +14,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; #[TestDox('DestinationData import')] class ImportsExampleAsExpectedTest extends AbstractTestCase { - protected function setUp(): void - { - parent::setUp(); - - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); - } - #[Test] public function importsExampleAsExpected(): void { @@ -49,7 +35,7 @@ class ImportsExampleAsExpectedTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php index 3b8517c..a028c64 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php @@ -14,9 +14,6 @@ class ImportsFeaturesTest extends AbstractTestCase #[Test] public function addsNewFeatures(): void { - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ]); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FeaturesImportConfiguration.php'); $this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithFeatures.json') ?: ''), @@ -30,9 +27,6 @@ class ImportsFeaturesTest extends AbstractTestCase #[Test] public function addsNewFeaturesToExistingOnes(): void { - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ]); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FeaturesImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ExistingFeatures.php'); $this->setUpResponses([ diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php index fa9912d..68c6689 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php @@ -17,9 +17,6 @@ class ImportsFirstDateOfDatesTest extends AbstractTestCase { parent::setUp(); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ]); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php'); $this->setDateAspect(new DateTimeImmutable('2022-07-13', new DateTimeZone('UTC'))); } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php index eed27d1..d5978d2 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php @@ -22,14 +22,6 @@ class ImportsSingleConfigurationTest extends AbstractTestCase $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restTemplate = ET2014A.json', - 'restLimit = 3', - 'restMode = next_months,12', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -43,7 +35,7 @@ class ImportsSingleConfigurationTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel%22', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json&q=name%3A%22Beispiel%22', (string)$requests[0]['request']->getUri()); self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsTextsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsTextsTest.php index 3831218..7f35f95 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsTextsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsTextsTest.php @@ -12,20 +12,6 @@ use PHPUnit\Framework\Attributes\TestDox; #[TestDox('DestinationData import')] class ImportsTextsTest extends AbstractTestCase { - protected function setUp(): void - { - parent::setUp(); - - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); - } - protected function tearDown(): void { $this->assertEmptyLog(); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php index a9c30e0..2ffa623 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php @@ -21,14 +21,6 @@ class ImportsTicketsTest extends AbstractTestCase $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithTickets.json') ?: ''), @@ -39,7 +31,7 @@ class ImportsTicketsTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); self::assertCount(1, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); + self::assertSame('http://meta.et4.de/rest.ashx/search/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsTickets.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php index c9c6880..d8556c2 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php @@ -24,11 +24,14 @@ class ImportsWithConfiguredRepeatUntilTest extends AbstractTestCase #[Test] public function recurringWeekly(): void { - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ], [ - 'repeatUntil = +30 days', - ]); + $this->getConnectionPool() + ->getConnectionForTable('tx_events_domain_model_import') + ->update( + 'tx_events_domain_model_import', + ['import_repeat_until' => '+30 days'], + ['uid' => '1'] + ) + ; $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringWeeklyWithoutRepeatUntil.json') ?: '')]); $this->executeCommand(); @@ -40,11 +43,14 @@ class ImportsWithConfiguredRepeatUntilTest extends AbstractTestCase #[Test] public function recurringDaily(): void { - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ], [ - 'repeatUntil = +10 days', - ]); + $this->getConnectionPool() + ->getConnectionForTable('tx_events_domain_model_import') + ->update( + 'tx_events_domain_model_import', + ['import_repeat_until' => '+10 days'], + ['uid' => '1'] + ) + ; $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringDailyWithoutRepeatUntil.json') ?: '')]); $this->executeCommand(); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php index d575462..411494d 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php @@ -16,14 +16,6 @@ final class ImportsWithLocationsTest extends AbstractTestCase parent::setUp(); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); } #[Test] diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithSystemConfiguredTimeZoneTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithSystemConfiguredTimeZoneTest.php index 7d16c74..039487a 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithSystemConfiguredTimeZoneTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithSystemConfiguredTimeZoneTest.php @@ -24,9 +24,6 @@ class ImportsWithSystemConfiguredTimeZoneTest extends AbstractTestCase parent::setUp(); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - ]); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->setDateAspect(new DateTimeImmutable('2022-07-13', new DateTimeZone('UTC'))); } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php index 2db6c8b..9050d80 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php @@ -17,14 +17,6 @@ class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTestCase { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -37,12 +29,6 @@ class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); - self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); - self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); - self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); - self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); - self::assertCount( 0, $this->getAllRecords('tx_events_domain_model_partner'), diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php index b05d33d..df93ee5 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php @@ -15,14 +15,6 @@ class ImportsWithoutLocationTest extends AbstractTestCase public function importsWithoutLocationIfNotProvided(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithoutLocation.json') ?: ''), diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php index 0860b33..7af5a93 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php @@ -17,14 +17,6 @@ class ImportsWithoutRegionIfNotProvidedTest extends AbstractTestCase { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); $requests = &$this->setUpResponses([ new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/Response.json') ?: ''), @@ -36,12 +28,6 @@ class ImportsWithoutRegionIfNotProvidedTest extends AbstractTestCase self::assertSame(0, $tester->getStatusCode()); - self::assertCount(4, $requests, 'Unexpected number of requests were made.'); - self::assertSame('https://example.com/some-path/?experience=beispielstadt&licensekey=example-license&type=Event&mode=next_months%2C12&limit=3&template=ET2014A.json', (string)$requests[0]['request']->getUri()); - self::assertSame('https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', (string)$requests[1]['request']->getUri()); - self::assertSame('https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg', (string)$requests[2]['request']->getUri()); - self::assertSame('https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg', (string)$requests[3]['request']->getUri()); - self::assertCount( 0, $this->getAllRecords('tx_events_domain_model_partner'), diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php b/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php index 7beea0e..c95b473 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php @@ -34,15 +34,6 @@ final class CategoriesAssignEventTest extends AbstractTestCase $this->testExtensionsToLoad[] = 'typo3conf/ext/events/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_categories/'; parent::setUp(); - - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); } #[Test] diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php b/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php index cbce582..7b29c2a 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php @@ -34,15 +34,6 @@ final class EventImportEventTest extends AbstractTestCase $this->testExtensionsToLoad[] = 'typo3conf/ext/events/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_event'; parent::setUp(); - - $this->setUpConfiguration([ - 'restUrl = https://example.com/some-path/', - 'license = example-license', - 'restType = Event', - 'restLimit = 3', - 'restMode = next_months,12', - 'restTemplate = ET2014A.json', - ]); } #[Test] diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanKeepCustomCategoriesAssigned.php b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanKeepCustomCategoriesAssigned.php index e68936d..a011ae9 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanKeepCustomCategoriesAssigned.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanKeepCustomCategoriesAssigned.php @@ -12,6 +12,9 @@ return [ 'files_folder' => '1:/staedte/beispielstadt/events/', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', 'categories_pid' => 2, 'category_parent' => 2, ], diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanModifyEvent.php b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanModifyEvent.php index 38d9cfd..19caadd 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanModifyEvent.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Database/RegisteredEventHandlerCanModifyEvent.php @@ -12,6 +12,9 @@ return [ 'files_folder' => '1:/staedte/beispielstadt/events/', 'region' => '1', 'rest_experience' => 'beispielstadt', + 'rest_license_key' => 'example-license', + 'rest_limit' => '3', + 'rest_mode' => 'next_months,12', ], ], ]; diff --git a/Tests/Unit/Domain/Model/ImportTest.php b/Tests/Unit/Domain/Model/ImportTest.php index 9becf22..9662310 100644 --- a/Tests/Unit/Domain/Model/ImportTest.php +++ b/Tests/Unit/Domain/Model/ImportTest.php @@ -21,7 +21,8 @@ class ImportTest extends TestCase $subject = new Import( $folder, 0, - '' + '', + '', ); self::assertInstanceOf( @@ -38,7 +39,8 @@ class ImportTest extends TestCase $subject = new Import( $folder, 0, - 'experience' + '', + 'experience', ); self::assertSame( @@ -55,7 +57,8 @@ class ImportTest extends TestCase $subject = new Import( $folder, 20, - '' + '', + '', ); self::assertSame( @@ -75,6 +78,9 @@ class ImportTest extends TestCase 0, '', '', + 'next_months,12', + 500, + '', 0, null, 0, @@ -96,7 +102,8 @@ class ImportTest extends TestCase $subject = new Import( $folder, 0, - '' + '', + '', ); self::assertSame( @@ -115,6 +122,9 @@ class ImportTest extends TestCase 0, '', '', + 'next_months,12', + 500, + '', 10 ); @@ -135,6 +145,9 @@ class ImportTest extends TestCase 0, '', '', + 'next_months,12', + 500, + '', 0, $category ); @@ -155,6 +168,9 @@ class ImportTest extends TestCase 0, '', '', + 'next_months,12', + 500, + '', 0, null, 10 @@ -177,6 +193,9 @@ class ImportTest extends TestCase 0, '', '', + 'next_months,12', + 500, + '', 0, null, 0, @@ -198,12 +217,15 @@ class ImportTest extends TestCase $folder, 0, '', + '', + 'next_months,12', + 500, 'name:"Test"' ); self::assertSame( 'name:"Test"', - $subject->getSearchQuery() + $subject->getRestSearchQuery() ); } } diff --git a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php index 561cd42..8608881 100644 --- a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php @@ -13,8 +13,8 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\Log\LogManager; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use WerkraumMedia\Events\Domain\Model\Date; +use WerkraumMedia\Events\Domain\Model\Import; use WerkraumMedia\Events\Service\DestinationDataImportService\DatesFactory; class DatesFactoryTest extends TestCase @@ -28,7 +28,6 @@ class DatesFactoryTest extends TestCase return new DatesFactory( $this->createContext(new DateTimeImmutable($contextDate)), - $this->createStub(ConfigurationManager::class), $logManager ); } @@ -50,7 +49,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates($unkownInput, false); + $result = $subject->createDates($this->createStub(Import::class), $unkownInput, false); self::assertInstanceOf(Generator::class, $result); self::assertCount(0, iterator_to_array($result)); @@ -76,7 +75,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'start' => '2022-04-01T16:00:00+02:00', 'end' => '2022-04-01T17:00:00+02:00', 'tz' => 'Europe/Berlin', @@ -98,9 +97,11 @@ class DatesFactoryTest extends TestCase #[Test] public function returnsWeeklyWithConfiguredRepeat(): void { + $import = $this->createStub(Import::class); + $import->method('getRepeatUntil')->willReturn('+60 days'); $subject = $this->createTestSubject('2023-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($import, [[ 'weekdays' => [ 'Monday', 'Friday', @@ -123,7 +124,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'start' => '2022-04-01T16:00:00+02:00', 'end' => '2022-04-01T17:00:00+02:00', 'tz' => 'Europe/Berlin', @@ -147,7 +148,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'start' => '2022-10-29T16:00:00+02:00', 'end' => '2022-10-29T17:00:00+02:00', 'repeatUntil' => '2022-11-02T17:00:00+01:00', @@ -176,7 +177,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'start' => '2022-10-29T16:00:00+02:00', 'end' => '2022-10-29T17:00:00+02:00', 'repeatUntil' => '2022-11-02T17:00:00+01:00', @@ -205,7 +206,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'weekdays' => [ 'Saturday', 'Sunday', @@ -246,7 +247,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); - $result = $subject->createDates([[ + $result = $subject->createDates($this->createStub(Import::class), [[ 'weekdays' => [ 'Saturday', 'Sunday', @@ -287,7 +288,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([ + $result = $subject->createDates($this->createStub(Import::class), [ [ 'start' => '2022-06-21T16:00:00+02:00', 'end' => '2022-06-21T22:00:00+02:00', @@ -332,7 +333,7 @@ class DatesFactoryTest extends TestCase { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); - $result = $subject->createDates([ + $result = $subject->createDates($this->createStub(Import::class), [ [ 'start' => '2022-06-21T16:00:00+02:00', 'end' => '2022-06-21T22:00:00+02:00', diff --git a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php index df109fb..cbf47f2 100644 --- a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php @@ -9,7 +9,6 @@ use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; use WerkraumMedia\Events\Domain\Model\Import; -use WerkraumMedia\Events\Service\DestinationDataImportService\ArrayBasedConfigurationService; use WerkraumMedia\Events\Service\DestinationDataImportService\UrlFactory; class UrlFactoryTest extends TestCase @@ -17,11 +16,7 @@ class UrlFactoryTest extends TestCase #[Test] public function canBeCreated(): void { - $configurationManager = new ArrayBasedConfigurationService([]); - - $subject = new UrlFactory( - $configurationManager - ); + $subject = new UrlFactory(); self::assertInstanceOf( UrlFactory::class, @@ -31,16 +26,14 @@ class UrlFactoryTest extends TestCase #[DataProvider('possibleImports')] #[Test] + /** + * @param Stub&Import $import + */ public function createSearchResultUrl( - Stub $import, - array $settings, + Import $import, string $expectedResult ): void { - $configurationManager = new ArrayBasedConfigurationService($settings); - - $subject = new UrlFactory( - $configurationManager - ); + $subject = new UrlFactory(); $result = $subject->createSearchResultUrl($import); @@ -56,62 +49,42 @@ class UrlFactoryTest extends TestCase 'All provided' => [ 'import' => (function () { $import = self::createStub(Import::class); + $import->method('getRestLicenseKey')->willReturn('licenseKey'); $import->method('getRestExperience')->willReturn('experience'); - $import->method('getSearchQuery')->willReturn(''); + $import->method('getRestMode')->willReturn('restMode'); + $import->method('getRestLimit')->willReturn(500); + $import->method('getRestSearchQuery')->willReturn(''); return $import; })(), - 'settings' => [ - 'restUrl' => 'https://example.com/path', - 'license' => 'licenseKey', - 'restType' => 'restType', - 'restMode' => 'restMode', - 'restLimit' => 'restLimit', - 'restTemplate' => 'restTemplate', - ], - 'expectedResult' => 'https://example.com/path?experience=experience&licensekey=licenseKey&type=restType&mode=restMode&limit=restLimit&template=restTemplate', + 'expectedResult' => 'http://meta.et4.de/rest.ashx/search/?experience=experience&licensekey=licenseKey&type=Event&mode=restMode&limit=500&template=ET2014A.json', ], 'All missing' => [ 'import' => (function () { - $import = self::createStub(Import::class); - $import->method('getRestExperience')->willReturn(''); - $import->method('getSearchQuery')->willReturn(''); - - return $import; + return self::createStub(Import::class); })(), - 'settings' => [ - 'restUrl' => 'https://example.com/path', - ], - 'expectedResult' => 'https://example.com/path', + 'expectedResult' => 'http://meta.et4.de/rest.ashx/search/?type=Event&template=ET2014A.json', ], 'Some missing' => [ 'import' => (function () { $import = self::createStub(Import::class); + $import->method('getRestLicenseKey')->willReturn('licenseKey'); $import->method('getRestExperience')->willReturn('experience'); - $import->method('getSearchQuery')->willReturn(''); + $import->method('getRestLimit')->willReturn(500); return $import; })(), - 'settings' => [ - 'restUrl' => 'https://example.com/path', - 'license' => 'licenseKey', - 'restLimit' => 'restLimit', - 'restTemplate' => 'restTemplate', - ], - 'expectedResult' => 'https://example.com/path?experience=experience&licensekey=licenseKey&limit=restLimit&template=restTemplate', + 'expectedResult' => 'http://meta.et4.de/rest.ashx/search/?experience=experience&licensekey=licenseKey&type=Event&limit=500&template=ET2014A.json', ], 'With search query' => [ 'import' => (function () { $import = self::createStub(Import::class); $import->method('getRestExperience')->willReturn('experience'); - $import->method('getSearchQuery')->willReturn('name:"Test Something"'); + $import->method('getRestSearchQuery')->willReturn('name:"Test Something"'); return $import; })(), - 'settings' => [ - 'restUrl' => 'https://example.com/path', - ], - 'expectedResult' => 'https://example.com/path?experience=experience&q=name%3A%22Test+Something%22', + 'expectedResult' => 'http://meta.et4.de/rest.ashx/search/?experience=experience&type=Event&template=ET2014A.json&q=name%3A%22Test+Something%22', ], ]; } diff --git a/ext_tables.sql b/ext_tables.sql index 3fabde0..183d802 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -83,10 +83,14 @@ CREATE TABLE tx_events_domain_model_import ( region int(11) unsigned DEFAULT '0' NOT NULL, + rest_license_key text, rest_experience varchar(1024) DEFAULT '' NOT NULL, + rest_mode varchar(1024) DEFAULT 'next_months,12' NOT NULL, + rest_limit int(11) unsigned DEFAULT '500' NOT NULL, rest_search_query text, import_features tinyint(4) DEFAULT '0' NOT NULL, + import_repeat_until varchar(255) DEFAULT '' NOT NULL, ); CREATE TABLE tx_events_domain_model_location (