From 032beaa7d35991ba687f2dbd927987d6f8845b9f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 7 Nov 2023 10:37:52 +0100 Subject: [PATCH] BREAKING: TYPO3 v12 support * Migrated all fixtures to PHP. * Removed version specific adjustments. --- .gitattributes | 1 + .github/workflows/ci.yaml | 41 +- .php-cs-fixer.dist.php | 5 +- .../Pagination/SlidingWindowPagination.php | 178 ---- Classes/Caching/CacheManager.php | 13 +- Classes/Caching/PageCacheTimeout.php | 46 +- ...inationDataViaAllConfigruationsCommand.php | 16 +- ...DestinationDataViaConfigruationCommand.php | 19 +- Classes/Command/RemoveAllCommand.php | 9 +- Classes/Command/RemovePastCommand.php | 9 +- Classes/Controller/AbstractController.php | 20 +- Classes/Controller/DateController.php | 35 +- Classes/Controller/EventController.php | 17 +- .../Domain/DestinationData/ImportFactory.php | 46 +- Classes/Domain/Model/Category.php | 36 +- Classes/Domain/Model/Date.php | 121 +-- Classes/Domain/Model/Dto/DateDemand.php | 13 +- .../Domain/Model/Dto/DateDemandFactory.php | 13 +- Classes/Domain/Model/Event.php | 137 +-- Classes/Domain/Model/Import.php | 69 +- Classes/Domain/Model/Location.php | 71 +- Classes/Domain/Model/Organizer.php | 59 +- Classes/Domain/Model/Partner.php | 12 +- Classes/Domain/Model/Region.php | 10 +- .../Domain/Repository/CategoryRepository.php | 6 +- Classes/Domain/Repository/DateRepository.php | 62 +- Classes/Domain/Repository/EventRepository.php | 6 +- .../Events/Controller/DateListVariables.php | 52 +- .../Events/Controller/DateSearchVariables.php | 62 +- Classes/Extbase/AddSpecialProperties.php | 25 +- Classes/Pagination/Factory.php | 2 +- Classes/Service/CategoryService.php | 14 +- Classes/Service/Cleanup/Database.php | 59 +- Classes/Service/Cleanup/Files.php | 92 +- Classes/Service/CleanupService.php | 18 +- Classes/Service/DataProcessingForModels.php | 41 +- .../Service/DestinationDataImportService.php | 166 +--- .../CategoriesAssignment.php | 16 +- .../CategoriesAssignment/Import.php | 32 +- .../DataFetcher.php | 34 +- .../DataHandler.php | 4 +- .../DataHandler/Assignment.php | 21 +- .../DatesFactory.php | 87 +- .../Events/CategoriesAssignEvent.php | 10 +- .../Events/EventImportEvent.php | 16 +- .../FilesAssignment.php | 37 +- .../LocationAssignment.php | 8 +- .../DestinationDataImportService/Slugger.php | 33 +- .../Slugger/Date.php | 13 +- .../Slugger/Registry.php | 6 +- .../UrlFactory.php | 8 +- .../Testing/TypoScriptInstructionModifier.php | 54 -- Classes/Updates/MigrateDuplicateLocations.php | 25 +- Classes/Updates/MigrateOldLocations.php | 41 +- Configuration/Extbase/Persistence/Classes.php | 4 +- Configuration/Services.yaml | 3 + Configuration/TCA/Overrides/pages.php | 13 +- Configuration/TCA/Overrides/sys_category.php | 4 +- Configuration/TCA/Overrides/sys_template.php | 4 +- Configuration/TCA/Overrides/tt_content.php | 19 +- .../tx_events_domain_model_event.php | 29 - .../TCA/tx_events_domain_model_date.php | 71 +- .../TCA/tx_events_domain_model_event.php | 124 +-- .../TCA/tx_events_domain_model_import.php | 12 +- .../TCA/tx_events_domain_model_location.php | 32 +- .../TCA/tx_events_domain_model_organizer.php | 33 +- .../TCA/tx_events_domain_model_partner.php | 39 +- .../TCA/tx_events_domain_model_region.php | 32 +- Configuration/TypoScript/setup.typoscript | 4 - Documentation/Changelog/4.0.0.rst | 12 +- Documentation/Index.rst | 1 - Documentation/Maintenance.rst | 16 - Documentation/Maintenance/TYPO3/V10.rst | 17 - Documentation/Maintenance/TYPO3/V11.rst | 12 - Patches/testing-framework-request-state.patch | 28 + Patches/testing-framework-ts-record.patch | 18 + .../Functional/AbstractFunctionalTestCase.php | 37 +- .../Fixtures/RemoveAllTestDatabase.php | 7 - .../Fixtures/RemovePastTestDatabase.php | 23 - Tests/Functional/Cleanup/RemoveAllTest.php | 10 +- Tests/Functional/Cleanup/RemovePastTest.php | 10 +- Tests/Functional/Fixtures/BeUsers.php | 17 + Tests/Functional/Frontend/CacheTest.php | 80 +- Tests/Functional/Frontend/DatesTest.php | 50 +- .../Returns404IfEventIsHidden.php | 30 + .../ReturnsDateWithinTimeSpan.csv | 18 +- .../ReturnsDateWithinTimeSpan.php | 125 +++ ...rnsOnlyDatesWithAvailableEventByDemand.php | 43 + .../ReturnsUpcomingDates.php | 2 - Tests/Functional/Frontend/FilterTest.php | 23 +- .../Extensions/example/Classes/UserFunc.php | 7 +- .../Extensions/example/ext_localconf.php | 7 +- ...{AbstractTest.php => AbstractTestCase.php} | 2 +- .../ImportDoesntBreakWithLongFileTitle.csv | 42 +- .../ImportDoesntBreakWithLongFileTitle.php | 134 +++ ...ImportDoesntEndUpInEndlessDateCreation.csv | 10 + ...ImportDoesntEndUpInEndlessDateCreation.php | 88 ++ ...rtDoesntEndUpInEndlessDateCreationTest.csv | 10 - ...sImagesAddsMultipleImagestoSingleEvent.php | 8 +- ...dlesImagesAddsNewImageToExistingImages.php | 11 +- .../ImportHandlesImagesAddsNewImages.php | 11 +- ...lesImagesRemovesNoLongerExistingImages.php | 8 +- ...mportHandlesImagesUpdatesExistingImage.php | 8 +- ...ortHandlesImagesUpdatesSortingOfImages.php | 8 +- .../Assertions/ImportsAllConfiguration.csv | 61 ++ .../Assertions/ImportsAllConfiguration.php | 884 ++++++++++++++++++ .../ImportsAllConfigurationTest.csv | 61 -- .../Assertions/ImportsExampleAsExpected.csv | 86 +- .../Assertions/ImportsExampleAsExpected.php | 596 ++++++++++++ .../ImportsFeaturesAddsNewFeatures.php | 175 ++++ .../ImportsFirstDateOfRecurringDatesDaily.php | 50 + ...ImportsFirstDateOfRecurringDatesWeekly.php | 36 + .../ImportsFirstDateOfSingleDate.php | 22 + ...ingDatesDailyWithConfiguredRepeatUntil.php | 85 ++ ...ngDatesWeeklyWithConfiguredRepeatUntil.php | 43 + .../Assertions/ImportsTickets.php | 20 + .../Assertions/ImportsWithLocations.php | 2 - .../ImportsWithoutCategoryIfNotProvided.php | 134 +++ .../ImportsWithoutLocationIfNotProvided.csv | 12 +- .../ImportsWithoutLocationIfNotProvided.php | 50 + .../ImportsWithoutRegionIfNotProvided.csv | 20 +- .../ImportsWithoutRegionIfNotProvided.php | 134 +++ .../ImportHandlesImagesExistingData.php | 8 +- .../ImportCleansTransientFiles.php | 62 ++ .../ImportCleansTransientFilesTest.php | 12 +- .../ImportDoesNotUseUploadsFolderTest.php | 12 +- ...ImportDoesntBreakWithLongFileTitleTest.php | 9 +- ...rtDoesntEndUpInEndlessDateCreationTest.php | 12 +- .../ImportHandlesImagesTest.php | 32 +- .../ImportsAllConfigurationTest.php | 18 +- .../ImportsExampleAsExpectedTest.php | 22 +- .../ImportsFeaturesTest.php | 21 +- .../ImportsFirstDateOfDatesTest.php | 30 +- .../ImportsSingleConfigurationTest.php | 18 +- .../ImportsTicketsTest.php | 13 +- .../ImportsWithConfiguredRepeatUntilTest.php | 24 +- .../ImportsWithLocationsTest.php | 19 +- ...mportsWithoutCategoryIfNotProvidedTest.php | 14 +- .../ImportsWithoutLocationTest.php | 14 +- .../ImportsWithoutRegionIfNotProvidedTest.php | 14 +- .../RegisteredEventHandlerCanModifyEvent.php | 4 +- .../CategoriesAssignEventTest.php | 9 +- .../EventImportEventTest.php | 9 +- .../custom_categories/ext_emconf.php | 4 +- .../Extensions/custom_event/ext_emconf.php | 4 +- .../Updates/MigrateDuplicateLocationsTest.php | 29 +- Tests/ProphecyTrait.php | 18 - Tests/Unit/Domain/Model/CategoryTest.php | 22 +- Tests/Unit/Domain/Model/DateTest.php | 71 +- .../Model/Dto/DateDemandFactoryTest.php | 104 +-- .../Model/Dto/EventDemandFactoryTest.php | 14 +- Tests/Unit/Domain/Model/EventTest.php | 18 +- Tests/Unit/Domain/Model/ImportTest.php | 109 +-- Tests/Unit/Domain/Model/LocationTest.php | 14 +- .../Controller/DateListVariablesTest.php | 65 +- .../Controller/DateSearchVariablesTest.php | 63 +- .../DatesFactoryTest.php | 83 +- .../LocationAssignmentTest.php | 17 +- .../UrlFactoryTest.php | 76 +- composer.json | 45 +- ext_emconf.php | 2 - ext_localconf.php | 39 +- ext_tables.php | 19 - phpstan-baseline.neon | 117 +-- phpstan.neon | 17 +- phpunit.xml.dist | 27 +- shell.nix | 6 +- 167 files changed, 4171 insertions(+), 3061 deletions(-) delete mode 100644 Classes/Backports/V12/Pagination/SlidingWindowPagination.php delete mode 100644 Classes/Testing/TypoScriptInstructionModifier.php delete mode 100644 Configuration/TCA/Overrides/tx_events_domain_model_event.php delete mode 100644 Documentation/Maintenance.rst delete mode 100644 Documentation/Maintenance/TYPO3/V10.rst delete mode 100644 Documentation/Maintenance/TYPO3/V11.rst create mode 100644 Patches/testing-framework-request-state.patch create mode 100644 Patches/testing-framework-ts-record.patch create mode 100644 Tests/Functional/Fixtures/BeUsers.php create mode 100644 Tests/Functional/Frontend/DatesTestFixtures/Returns404IfEventIsHidden.php create mode 100644 Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.php create mode 100644 Tests/Functional/Frontend/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.php rename Tests/Functional/Import/DestinationDataTest/{AbstractTest.php => AbstractTestCase.php} (90%) create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.php delete mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.php delete mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.php create mode 100644 Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFiles.php delete mode 100644 Tests/ProphecyTrait.php delete mode 100644 ext_tables.php diff --git a/.gitattributes b/.gitattributes index ae77c43..0a506e7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ Tests export-ignore +Patches export-ignore .gitlab-ci.yml export-ignore shell.nix export-ignore diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d3b0a5c..89d8a01 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,12 +15,9 @@ jobs: strategy: matrix: php-version: - - 7.2 - - 7.3 - - 7.4 - - 8.0 - 8.1 - 8.2 + - 8.3 steps: - name: Checkout uses: actions/checkout@v3 @@ -43,7 +40,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.4" + php-version: "8.2" tools: composer:v2 - name: Install xmllint @@ -71,7 +68,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.2" tools: composer:v2 - name: Install dependencies @@ -87,20 +84,12 @@ jobs: strategy: matrix: include: - - php-version: '7.2' - typo3-version: '^10.4' - - php-version: '7.3' - typo3-version: '^10.4' - - php-version: '7.4' - typo3-version: '^10.4' - - php-version: '7.4' - typo3-version: '^11.5' - - php-version: '8.0' - typo3-version: '^11.5' - php-version: '8.1' - typo3-version: '^11.5' + typo3-version: '^12.4' - php-version: '8.2' - typo3-version: '^11.5' + typo3-version: '^12.4' + - php-version: '8.3' + typo3-version: '^12.4' steps: - uses: actions/checkout@v3 @@ -124,20 +113,12 @@ jobs: strategy: matrix: include: - - php-version: '7.2' - typo3-version: '^10.4' - - php-version: '7.3' - typo3-version: '^10.4' - - php-version: '7.4' - typo3-version: '^10.4' - - php-version: '7.4' - typo3-version: '^11.5' - - php-version: '8.0' - typo3-version: '^11.5' - php-version: '8.1' - typo3-version: '^11.5' + typo3-version: '^12.4' - php-version: '8.2' - typo3-version: '^11.5' + typo3-version: '^12.4' + - php-version: '8.3' + typo3-version: '^12.4' steps: - uses: actions/checkout@v3 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index df861ff..373caa4 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -17,8 +17,10 @@ 'concat_space' => ['spacing' => 'one'], 'declare_equal_normalize' => ['space' => 'none'], 'dir_constant' => true, + 'fully_qualified_strict_types' => false, 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], 'function_typehint_space' => true, + 'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], 'lowercase_cast' => true, 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], 'modernize_strpos' => true, @@ -38,6 +40,7 @@ 'no_superfluous_elseif' => true, 'no_trailing_comma_in_singleline_array' => true, 'no_unneeded_control_parentheses' => true, + 'no_unneeded_import_alias' => true, 'no_unused_imports' => true, 'no_useless_else' => true, 'no_whitespace_in_blank_line' => true, @@ -54,8 +57,8 @@ 'phpdoc_types' => true, 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], 'return_type_declaration' => ['space_before' => 'none'], - 'single_quote' => true, 'single_line_comment_style' => ['comment_types' => ['hash']], + 'single_quote' => true, 'single_trait_insert_per_statement' => true, 'trailing_comma_in_multiline' => ['elements' => ['arrays']], 'whitespace_after_comma_in_array' => true, diff --git a/Classes/Backports/V12/Pagination/SlidingWindowPagination.php b/Classes/Backports/V12/Pagination/SlidingWindowPagination.php deleted file mode 100644 index ec77939..0000000 --- a/Classes/Backports/V12/Pagination/SlidingWindowPagination.php +++ /dev/null @@ -1,178 +0,0 @@ -paginator = $paginator; - - if ($maximumNumberOfLinks > 0) { - $this->maximumNumberOfLinks = $maximumNumberOfLinks; - } - - $this->calculateDisplayRange(); - } - - public function getPreviousPageNumber(): ?int - { - $previousPage = $this->paginator->getCurrentPageNumber() - 1; - - if ($previousPage > $this->paginator->getNumberOfPages()) { - return null; - } - - return $previousPage >= $this->getFirstPageNumber() ? $previousPage : null; - } - - public function getNextPageNumber(): ?int - { - $nextPage = $this->paginator->getCurrentPageNumber() + 1; - - return $nextPage <= $this->paginator->getNumberOfPages() ? $nextPage : null; - } - - public function getFirstPageNumber(): int - { - return 1; - } - - public function getLastPageNumber(): int - { - return $this->paginator->getNumberOfPages(); - } - - public function getStartRecordNumber(): int - { - if ($this->paginator->getCurrentPageNumber() > $this->paginator->getNumberOfPages()) { - return 0; - } - - return $this->paginator->getKeyOfFirstPaginatedItem() + 1; - } - - public function getEndRecordNumber(): int - { - if ($this->paginator->getCurrentPageNumber() > $this->paginator->getNumberOfPages()) { - return 0; - } - - return $this->paginator->getKeyOfLastPaginatedItem() + 1; - } - - public function getAllPageNumbers(): array - { - return range($this->displayRangeStart, $this->displayRangeEnd); - } - - public function getDisplayRangeStart(): int - { - return $this->displayRangeStart; - } - - public function getDisplayRangeEnd(): int - { - return $this->displayRangeEnd; - } - - public function getHasLessPages(): bool - { - return $this->hasLessPages; - } - - public function getHasMorePages(): bool - { - return $this->hasMorePages; - } - - public function getMaximumNumberOfLinks(): int - { - return $this->maximumNumberOfLinks; - } - - public function getPaginator(): PaginatorInterface - { - return $this->paginator; - } - - protected function calculateDisplayRange(): void - { - $maximumNumberOfLinks = $this->maximumNumberOfLinks; - $numberOfPages = $this->paginator->getNumberOfPages(); - - if ($maximumNumberOfLinks > $numberOfPages) { - $maximumNumberOfLinks = $numberOfPages; - } - - $currentPage = $this->paginator->getCurrentPageNumber(); - $delta = floor($maximumNumberOfLinks / 2); - - $this->displayRangeStart = (int)($currentPage - $delta); - $this->displayRangeEnd = (int)($currentPage + $delta - ($maximumNumberOfLinks % 2 === 0 ? 1 : 0)); - - if ($this->displayRangeStart < 1) { - $this->displayRangeEnd -= $this->displayRangeStart - 1; - } - - if ($this->displayRangeEnd > $numberOfPages) { - $this->displayRangeStart -= $this->displayRangeEnd - $numberOfPages; - } - - $this->displayRangeStart = (int)max($this->displayRangeStart, 1); - $this->displayRangeEnd = (int)min($this->displayRangeEnd, $numberOfPages); - $this->hasLessPages = $this->displayRangeStart > 2; - $this->hasMorePages = $this->displayRangeEnd + 1 < $this->paginator->getNumberOfPages(); - } -} diff --git a/Classes/Caching/CacheManager.php b/Classes/Caching/CacheManager.php index 655a631..6493b12 100644 --- a/Classes/Caching/CacheManager.php +++ b/Classes/Caching/CacheManager.php @@ -28,15 +28,7 @@ class CacheManager { - /** - * @var Typo3CacheManager - */ - private $cacheManager; - - /** - * @var array - */ - private $tags = [ + private array $tags = [ 'tx_events_domain_model_date', 'tx_events_domain_model_event', 'tx_events_domain_model_organizer', @@ -45,9 +37,8 @@ class CacheManager ]; public function __construct( - Typo3CacheManager $cacheManager + private readonly Typo3CacheManager $cacheManager ) { - $this->cacheManager = $cacheManager; } public function addAllCacheTagsToPage(ContentObjectRenderer $cObject): void diff --git a/Classes/Caching/PageCacheTimeout.php b/Classes/Caching/PageCacheTimeout.php index e64cc26..d5eb090 100644 --- a/Classes/Caching/PageCacheTimeout.php +++ b/Classes/Caching/PageCacheTimeout.php @@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Frontend\Event\ModifyCacheLifetimeForPageEvent; use WerkraumMedia\Events\Domain\Model\Date; use WerkraumMedia\Events\Events\Controller\DateListVariables; @@ -41,40 +42,33 @@ */ class PageCacheTimeout implements SingletonInterface { - /** - * @var DateTimeImmutable|null - */ - private $timeout; + private ?DateTimeImmutable $timeout = null; /** * @var FrontendInterface */ private $runtimeCache; - /** - * @var Context - */ - private $context; - public function __construct( CacheManager $cacheManager, - Context $context + private readonly Context $context ) { $this->runtimeCache = $cacheManager->getCache('runtime'); - $this->context = $context; } - public function calculateCacheTimout( - array $parameters - ): int { - $typo3Timeout = $parameters['cacheTimeout']; + public function modifyCacheLifetimeForPage(ModifyCacheLifetimeForPageEvent $event): void + { $ourTimeout = $this->getTimeout(); - if ($ourTimeout === null) { - return $typo3Timeout; + return; } - return min($typo3Timeout, $ourTimeout); + $event->setCacheLifetime( + min( + $event->getCacheLifetime(), + $ourTimeout + ) + ); } public function trackDates(DateListVariables $event): void @@ -85,14 +79,10 @@ public function trackDates(DateListVariables $event): void } if ($event->getDemand()->shouldShowUpcoming()) { - $this->trackTimeoutByDate($event, static function (Date $date) { - return $date->getStart(); - }); + $this->trackTimeoutByDate($event, static fn (Date $date) => $date->getStart()); } - $this->trackTimeoutByDate($event, static function (Date $date) { - return $date->getEnd(); - }); + $this->trackTimeoutByDate($event, static fn (Date $date) => $date->getEnd()); } /** @@ -126,7 +116,8 @@ private function updateTimeout(DateTimeImmutable $newTimeout): void return; } - $this->runtimeCache->remove('core-tslib_fe-get_cache_timeout'); + $id = $GLOBALS['TYPO3_REQUEST']->getAttribute('routing')->getPageId(); + $this->runtimeCache->remove('cacheLifeTimeForPage_' . $id); $this->timeout = $newTimeout; } @@ -149,9 +140,4 @@ private function getExecution(): DateTimeImmutable return $execution; } - - public static function register(): void - { - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['get_cache_timeout']['events'] = self::class . '->calculateCacheTimout'; - } } diff --git a/Classes/Command/ImportDestinationDataViaAllConfigruationsCommand.php b/Classes/Command/ImportDestinationDataViaAllConfigruationsCommand.php index 381d02a..6a70eb2 100644 --- a/Classes/Command/ImportDestinationDataViaAllConfigruationsCommand.php +++ b/Classes/Command/ImportDestinationDataViaAllConfigruationsCommand.php @@ -11,23 +11,11 @@ class ImportDestinationDataViaAllConfigruationsCommand extends Command { - /** - * @var DestinationDataImportService - */ - private $destinationDataImportService; - - /** - * @var ImportFactory - */ - private $importFactory; - public function __construct( - DestinationDataImportService $destinationDataImportService, - ImportFactory $importFactory + private readonly DestinationDataImportService $destinationDataImportService, + private readonly ImportFactory $importFactory ) { parent::__construct(); - $this->destinationDataImportService = $destinationDataImportService; - $this->importFactory = $importFactory; } public function configure(): void diff --git a/Classes/Command/ImportDestinationDataViaConfigruationCommand.php b/Classes/Command/ImportDestinationDataViaConfigruationCommand.php index d69c353..7019cd2 100644 --- a/Classes/Command/ImportDestinationDataViaConfigruationCommand.php +++ b/Classes/Command/ImportDestinationDataViaConfigruationCommand.php @@ -2,6 +2,7 @@ namespace WerkraumMedia\Events\Command; +use Exception; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -12,23 +13,11 @@ class ImportDestinationDataViaConfigruationCommand extends Command { - /** - * @var DestinationDataImportService - */ - private $destinationDataImportService; - - /** - * @var ImportFactory - */ - private $importFactory; - public function __construct( - DestinationDataImportService $destinationDataImportService, - ImportFactory $importFactory + private readonly DestinationDataImportService $destinationDataImportService, + private readonly ImportFactory $importFactory ) { parent::__construct(); - $this->destinationDataImportService = $destinationDataImportService; - $this->importFactory = $importFactory; } public function configure(): void @@ -51,7 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (is_numeric($configurationUid)) { $configurationUid = (int)$configurationUid; } else { - throw new \Exception('No numeric uid for configuration provided.', 1643267138); + throw new Exception('No numeric uid for configuration provided.', 1643267138); } $import = $this->importFactory->createFromUid( diff --git a/Classes/Command/RemoveAllCommand.php b/Classes/Command/RemoveAllCommand.php index 8b15e2f..e509821 100644 --- a/Classes/Command/RemoveAllCommand.php +++ b/Classes/Command/RemoveAllCommand.php @@ -10,16 +10,9 @@ class RemoveAllCommand extends Command { - /** - * @var CleanupService - */ - private $cleanupService; - public function __construct( - CleanupService $cleanupService + private readonly CleanupService $cleanupService ) { - $this->cleanupService = $cleanupService; - parent::__construct(); } diff --git a/Classes/Command/RemovePastCommand.php b/Classes/Command/RemovePastCommand.php index cce533b..3ecf663 100644 --- a/Classes/Command/RemovePastCommand.php +++ b/Classes/Command/RemovePastCommand.php @@ -10,16 +10,9 @@ class RemovePastCommand extends Command { - /** - * @var CleanupService - */ - private $cleanupService; - public function __construct( - CleanupService $cleanupService + private readonly CleanupService $cleanupService ) { - $this->cleanupService = $cleanupService; - parent::__construct(); } diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index b99c67e..97a704e 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -21,12 +21,12 @@ * 02110-1301, USA. */ -use TYPO3\CMS\Core\Http\ImmediateResponseException; use TYPO3\CMS\Core\Http\PropagateResponseException; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\ErrorController; +use TYPO3Fluid\Fluid\View\ViewInterface; use WerkraumMedia\Events\Caching\CacheManager; class AbstractController extends ActionController @@ -49,7 +49,7 @@ protected function initializeAction(): void { parent::initializeAction(); - $cObject = $this->configurationManager->getContentObject(); + $cObject = $this->request->getAttribute('currentContentObject'); if ($cObject instanceof ContentObjectRenderer) { $this->cacheManager->addAllCacheTagsToPage($cObject); } @@ -58,12 +58,12 @@ protected function initializeAction(): void /** * Extend original to also add data from current cobject if available. */ - protected function resolveView() + protected function resolveView(): ViewInterface { $view = parent::resolveView(); $view->assign('data', []); - $cObject = $this->configurationManager->getContentObject(); + $cObject = $this->request->getAttribute('currentContentObject'); if ($cObject instanceof ContentObjectRenderer && is_array($cObject->data)) { $view->assign('data', $cObject->data); } @@ -73,17 +73,9 @@ protected function resolveView() protected function trigger404(string $message): void { - $errorController = GeneralUtility::makeInstance(ErrorController::class); - - if (class_exists(ImmediateResponseException::class)) { - throw new ImmediateResponseException( - $errorController->pageNotFoundAction($GLOBALS['TYPO3_REQUEST'], $message), - 1695881164 - ); - } - throw new PropagateResponseException( - $errorController->pageNotFoundAction($this->request, $message), + GeneralUtility::makeInstance(ErrorController::class) + ->pageNotFoundAction($this->request, $message), 1695881170 ); } diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 512e06c..ffbc332 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -2,6 +2,8 @@ namespace WerkraumMedia\Events\Controller; +use Exception; +use Psr\Http\Message\ResponseInterface; use Throwable; use TYPO3\CMS\Core\EventDispatcher\EventDispatcher; use TYPO3\CMS\Extbase\Annotation as Extbase; @@ -82,7 +84,7 @@ protected function initializeAction(): void { parent::initializeAction(); - $contentObject = $this->configurationManager->getContentObject(); + $contentObject = $this->request->getAttribute('currentContentObject'); if ($contentObject !== null) { $this->demandFactory->setContentObjectRenderer($contentObject); } @@ -91,14 +93,10 @@ protected function initializeAction(): void $this->handlePostRequest(); } - /** - * @param array $search - * @param int $currentPage - */ public function listAction( array $search = [], int $currentPage = 1 - ): void { + ): ResponseInterface { $demand = $this->demandFactory->fromSettings($this->settings); if ($search !== []) { $demand = $this->demandFactory->createFromRequestValues($search, $this->settings); @@ -117,15 +115,13 @@ public function listAction( ) )); if (!$event instanceof DateListVariables) { - throw new \Exception('Did not retrieve DateSearchVariables from event dispatcher, got: ' . get_class($event), 1657542318); + throw new Exception('Did not retrieve DateSearchVariables from event dispatcher, got: ' . $event::class, 1657542318); } $this->view->assignMultiple($event->getVariablesForView()); + return $this->htmlResponse(); } - /** - * @param array $search - */ - public function searchAction(array $search = []): void + public function searchAction(array $search = []): ResponseInterface { $demand = $this->demandFactory->fromSettings($this->settings); if ($search !== []) { @@ -140,29 +136,30 @@ public function searchAction(array $search = []): void $this->categoryRepository->findAllCurrentlyAssigned($this->settings['uids']['featuresParent'] ?? 0, 'features') )); if (!$event instanceof DateSearchVariables) { - throw new \Exception('Did not retrieve DateSearchVariables from event dispatcher, got: ' . get_class($event), 1657542318); + throw new Exception('Did not retrieve DateSearchVariables from event dispatcher, got: ' . $event::class, 1657542318); } $this->view->assignMultiple($event->getVariablesForView()); + return $this->htmlResponse(); } - public function teaserAction(): void + public function teaserAction(): ResponseInterface { $dates = $this->dateRepository->findByUids($this->settings['eventUids']); $this->view->assign('dates', $dates); + return $this->htmlResponse(); } - /** - * @Extbase\IgnoreValidation("date") - */ - public function showAction(Date $date): void + #[Extbase\IgnoreValidation(['value' => 'date'])] + public function showAction(Date $date): ResponseInterface { try { $date->getEvent(); - } catch (Throwable $e) { + } catch (Throwable) { $this->trigger404('No event found for requested date.'); } $this->view->assign('date', $date); + return $this->htmlResponse(); } /** @@ -178,7 +175,7 @@ private function handlePostRequest(): void && is_array($this->request->getArgument('search')) ) { $namespace = $this->extensionService->getPluginNamespace(null, null); - $this->redirectToUri($this->configurationManager->getContentObject()->typoLink_URL([ + $this->redirectToUri($this->request->getAttribute('currentContentObject')->typoLink_URL([ 'parameter' => 't3://page?uid=current', 'additionalParams' => '&' . http_build_query([ $namespace => [ diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index c3ea629..2293647 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -2,6 +2,7 @@ namespace WerkraumMedia\Events\Controller; +use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Extbase\Annotation as Extbase; use WerkraumMedia\Events\Domain\Model\Dto\EventDemandFactory; use WerkraumMedia\Events\Domain\Model\Event; @@ -42,35 +43,37 @@ protected function initializeAction(): void $this->dataProcessing->setConfigurationManager($this->configurationManager); } - public function listAction(): void + public function listAction(): ResponseInterface { $demand = $this->demandFactory->fromSettings($this->settings); $events = $this->eventRepository->findByDemand($demand); $this->view->assign('events', $events); + return $this->htmlResponse(); } - /** - * @Extbase\IgnoreValidation("event") - */ - public function showAction(Event $event): void + #[Extbase\IgnoreValidation(['value' => 'event'])] + public function showAction(Event $event): ResponseInterface { $this->view->assign('event', $event); + return $this->htmlResponse(); } /** * @deprecated Use listAction instead and configure settings properly. * Use Settings or something else to switch between list and teaser rendering. */ - public function teaserAction(): void + public function teaserAction(): ResponseInterface { $this->view->assignMultiple([ 'events' => $this->eventRepository->findByUids($this->settings['eventUids']), ]); + return $this->htmlResponse(); } - public function searchAction(string $search = ''): void + public function searchAction(string $search = ''): ResponseInterface { $this->view->assign('search', $search); $this->view->assign('events', $this->eventRepository->findSearchWord($search)); + return $this->htmlResponse(); } } diff --git a/Classes/Domain/DestinationData/ImportFactory.php b/Classes/Domain/DestinationData/ImportFactory.php index 515cf66..b2bb110 100644 --- a/Classes/Domain/DestinationData/ImportFactory.php +++ b/Classes/Domain/DestinationData/ImportFactory.php @@ -2,6 +2,8 @@ namespace WerkraumMedia\Events\Domain\DestinationData; +use Exception; +use PDO; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Resource\Folder; use TYPO3\CMS\Core\Resource\ResourceFactory; @@ -11,41 +13,17 @@ class ImportFactory { - /** - * @var ConnectionPool - */ - private $connectionPool; - - /** - * @var Session - */ - private $extbasePersistenceSession; - - /** - * @var DataMapper - */ - private $dataMapper; - - /** - * @var ResourceFactory - */ - private $resourceFactory; - /** * @var Folder */ private $folderInstance; public function __construct( - ConnectionPool $connectionPool, - Session $extbasePersistenceSession, - DataMapper $dataMapper, - ResourceFactory $resourceFactory + private readonly ConnectionPool $connectionPool, + private readonly Session $extbasePersistenceSession, + private readonly DataMapper $dataMapper, + private readonly ResourceFactory $resourceFactory ) { - $this->connectionPool = $connectionPool; - $this->extbasePersistenceSession = $extbasePersistenceSession; - $this->dataMapper = $dataMapper; - $this->resourceFactory = $resourceFactory; } public function createFromUid(int $uid): Import @@ -59,7 +37,7 @@ public function createFromUid(int $uid): Import public function createAll(): array { return array_map( - [$this, 'create'], + $this->create(...), $this->fetchImportRecords() ); } @@ -69,11 +47,11 @@ private function fetchImportRecord(int $uid): array $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_import'); $qb->select('*'); $qb->from('tx_events_domain_model_import'); - $qb->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid, \PDO::PARAM_INT))); + $qb->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid, PDO::PARAM_INT))); - $result = $qb->execute()->fetch(); + $result = $qb->executeQuery()->fetch(); if (is_array($result) === false) { - throw new \Exception('Could not fetch import record with uid "' . $uid . '".', 1643267492); + throw new Exception('Could not fetch import record with uid "' . $uid . '".', 1643267492); } $result = array_map('strval', $result); @@ -87,9 +65,9 @@ private function fetchImportRecords(): array $qb->select('*'); $qb->from('tx_events_domain_model_import'); - $result = $qb->execute()->fetchAll(); + $result = $qb->executeQuery()->fetchAll(); if (count($result) === 0) { - throw new \Exception('Could not fetch any import record.', 1643267492); + throw new Exception('Could not fetch any import record.', 1643267492); } foreach ($result as $key => $entry) { diff --git a/Classes/Domain/Model/Category.php b/Classes/Domain/Model/Category.php index ce32e70..4ca7f95 100644 --- a/Classes/Domain/Model/Category.php +++ b/Classes/Domain/Model/Category.php @@ -2,7 +2,7 @@ namespace WerkraumMedia\Events\Domain\Model; -use TYPO3\CMS\Extbase\Annotation as Extbase; +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; @@ -13,41 +13,22 @@ */ class Category extends AbstractEntity { - /** - * @var string - */ - protected $title = ''; - - /** - * @var int - */ - protected $sorting = 0; - - /** - * @var bool - */ - protected $hidden = false; + protected int $sorting = 0; /** * @var Category|null - * - * @Extbase\ORM\Lazy */ + #[Lazy] protected $parent; - /** - * @param Category|null $parent - */ public function __construct( - $parent, + ?Category $parent, int $pid, - string $title, - bool $hidden + protected string $title, + protected bool $hidden ) { $this->parent = $parent; $this->pid = $pid; - $this->title = $title; - $this->hidden = $hidden; } public function getTitle(): string @@ -60,10 +41,7 @@ public function getSorting(): int return $this->sorting; } - /** - * @return Category|null - */ - public function getParent() + public function getParent(): ?Category { if ($this->parent instanceof LazyLoadingProxy) { $this->parent->_loadRealInstance(); diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 18f3340..b3217e0 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -2,6 +2,9 @@ namespace WerkraumMedia\Events\Domain\Model; +use DateTime; +use DateTimeImmutable; +use DateTimeZone; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; /** @@ -9,60 +12,26 @@ */ class Date extends AbstractEntity { - /** - * @var \DateTime - */ - protected $start; - - /** - * @var \DateTime|null - */ - protected $end; - - /** - * @var string - */ - protected $canceled = 'no'; - - /** - * @var Date|null - */ - protected $postponedDate; - - /** - * @var Date|null - */ - protected $originalDate; - - /** - * @var \WerkraumMedia\Events\Domain\Model\Event - */ - protected $event; - - /** - * @var string - */ - protected $canceledLink = ''; - - /** - * @var int - */ - protected $_languageUid; - - /** - * @return \DateTime $start - */ - public function getStart() + protected DateTime $start; + + protected ?DateTime $end = null; + + protected string $canceled = 'no'; + + protected ?Date $postponedDate = null; + + protected ?Date $originalDate = null; + + protected Event $event; + + protected string $canceledLink = ''; + + public function getStart(): DateTime { return $this->start; } - /** - * @param \DateTime $start - * - * @return void - */ - public function setStart(\DateTime $start) + public function setStart(DateTime $start): void { $this->start = $start; } @@ -72,20 +41,12 @@ public function getHasUsefulStartTime(): bool return $this->getStart()->format('H:i') !== '00:00'; } - /** - * @return \DateTime|null end - */ - public function getEnd() + public function getEnd(): ?DateTime { return $this->end; } - /** - * @param \DateTime|null $end - * - * @return void - */ - public function setEnd($end) + public function setEnd(?DateTime $end): void { $this->end = $end; } @@ -102,55 +63,33 @@ public function getEndsOnSameDay(): bool return $end && $this->getStart()->format('Y-m-d') === $end->format('Y-m-d'); } - /** - * @return Event - */ public function getEvent(): Event { return $this->event; } - /** - * @param Event $event - */ public function setEvent(Event $event): self { $this->event = $event; return $this; } - /** - * @param int $languageUid - * - * @return void - */ - public function setLanguageUid($languageUid) + public function setLanguageUid(int $languageUid): void { $this->_languageUid = $languageUid; } - /** - * @return int - */ - public function getLanguageUid() + public function getLanguageUid(): int { return $this->_languageUid; } - /** - * @return string - */ public function getCanceled(): string { return $this->canceled; } - /** - * @param string $canceled - * - * @return void - */ - public function setCanceled(string $canceled) + public function setCanceled(string $canceled): void { $this->canceled = $canceled; } @@ -183,22 +122,22 @@ public static function createFromDestinationDataDate( bool $canceled ): self { return self::createFromDestinationData( - new \DateTimeImmutable($date['start'], new \DateTimeZone($date['tz'])), - new \DateTimeImmutable($date['end'], new \DateTimeZone($date['tz'])), + new DateTimeImmutable($date['start'], new DateTimeZone($date['tz'])), + new DateTimeImmutable($date['end'], new DateTimeZone($date['tz'])), $canceled ); } public static function createFromDestinationData( - \DateTimeImmutable $start, - \DateTimeImmutable $end, + DateTimeImmutable $start, + DateTimeImmutable $end, bool $canceled ): self { $date = new Date(); $date->setLanguageUid(-1); - $date->setStart(new \DateTime($start->format(\DateTime::W3C), $start->getTimezone())); - $date->setEnd(new \DateTime($end->format(\DateTime::W3C), $end->getTimezone())); + $date->setStart(new DateTime($start->format(DateTime::W3C), $start->getTimezone())); + $date->setEnd(new DateTime($end->format(DateTime::W3C), $end->getTimezone())); if ($canceled) { $date->setCanceled('canceled'); diff --git a/Classes/Domain/Model/Dto/DateDemand.php b/Classes/Domain/Model/Dto/DateDemand.php index 9c672cf..b6d2c6e 100644 --- a/Classes/Domain/Model/Dto/DateDemand.php +++ b/Classes/Domain/Model/Dto/DateDemand.php @@ -2,6 +2,7 @@ namespace WerkraumMedia\Events\Domain\Model\Dto; +use DateTimeImmutable; use TYPO3\CMS\Core\Utility\GeneralUtility; class DateDemand @@ -67,12 +68,12 @@ class DateDemand protected $limit = ''; /** - * @var \DateTimeImmutable|null + * @var DateTimeImmutable|null */ protected $startObject; /** - * @var \DateTimeImmutable|null + * @var DateTimeImmutable|null */ protected $endObject; @@ -303,7 +304,7 @@ public function getSynonymsForSearchword(): array return $this->synonyms[$searchWord] ?? []; } - public function getStartObject(): ?\DateTimeImmutable + public function getStartObject(): ?DateTimeImmutable { return $this->startObject; } @@ -327,10 +328,10 @@ public function setStart(?int $start): void if ($start === null) { return; } - $this->startObject = new \DateTimeImmutable(date('Y-m-d H:i', $start)); + $this->startObject = new DateTimeImmutable(date('Y-m-d H:i', $start)); } - public function getEndObject(): ?\DateTimeImmutable + public function getEndObject(): ?DateTimeImmutable { return $this->endObject; } @@ -364,7 +365,7 @@ public function setEnd(?int $end): void return; } - $this->endObject = new \DateTimeImmutable(date('Y-m-d H:i', $end)); + $this->endObject = new DateTimeImmutable(date('Y-m-d H:i', $end)); } public function setUseMidnight(bool $useMidnight): void diff --git a/Classes/Domain/Model/Dto/DateDemandFactory.php b/Classes/Domain/Model/Dto/DateDemandFactory.php index fbe4ad6..02d6e0c 100644 --- a/Classes/Domain/Model/Dto/DateDemandFactory.php +++ b/Classes/Domain/Model/Dto/DateDemandFactory.php @@ -27,20 +27,11 @@ class DateDemandFactory { - /** - * @var TypoScriptService - */ - private $typoScriptService; - - /** - * @var contentObjectRenderer - */ - private $contentObjectRenderer; + private ?\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer = null; public function __construct( - TypoScriptService $typoScriptService + private readonly TypoScriptService $typoScriptService ) { - $this->typoScriptService = $typoScriptService; } public function setContentObjectRenderer( diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index bf26f1b..b02a30f 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -2,7 +2,8 @@ namespace WerkraumMedia\Events\Domain\Model; -use TYPO3\CMS\Extbase\Annotation as Extbase; +use TYPO3\CMS\Extbase\Annotation\ORM\Cascade; +use TYPO3\CMS\Extbase\Annotation\ORM\Lazy; use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; @@ -10,154 +11,84 @@ class Event extends AbstractEntity { - /** - * @var string - */ - protected $title = ''; + protected string $title = ''; - /** - * @var string - */ - protected $subtitle = ''; + protected string $subtitle = ''; - /** - * @var string - */ - protected $globalId = ''; + protected string $globalId = ''; - /** - * @var string - */ - protected $slug = ''; + protected string $slug = ''; - /** - * @var bool - */ - protected $highlight = false; + protected bool $highlight = false; - /** - * @var string - */ - protected $teaser = ''; + protected string $teaser = ''; - /** - * @var string - */ - protected $details = ''; + protected string $details = ''; - /** - * @var string - */ - protected $priceInfo = ''; + protected string $priceInfo = ''; - /** - * @var string - */ - protected $web = ''; + protected string $web = ''; - /** - * @var string - */ - protected $ticket = ''; + protected string $ticket = ''; - /** - * @var string - */ - protected $facebook = ''; + protected string $facebook = ''; - /** - * @var string - */ - protected $youtube = ''; + protected string $youtube = ''; - /** - * @var string - */ - protected $instagram = ''; + protected string $instagram = ''; /** * @var ObjectStorage - * - * @Extbase\ORM\Cascade remove */ - protected $images; + #[Cascade(['value' => 'remove'])] + protected ObjectStorage $images; /** * @var ObjectStorage - * - * @Extbase\ORM\Cascade remove - * @Extbase\ORM\Lazy */ - protected $dates; + #[Cascade(['value' => 'remove'])] + #[Lazy] + protected ObjectStorage $dates; - /** - * @var Location|null - */ - protected $location; + protected ?Location $location = null; - /** - * @var Organizer|null - */ - protected $organizer; + protected ?Organizer $organizer = null; - /** - * @var Region|null - */ - protected $region; + protected ?Region $region = null; - /** - * @var string - */ - protected $pages = ''; + protected string $pages = ''; /** * @var ObjectStorage */ - protected $categories; + protected ObjectStorage $categories; /** * @var ObjectStorage */ - protected $features; + protected ObjectStorage $features; /** * @var ObjectStorage */ - protected $partner; + protected ObjectStorage $partner; /** * @var ObjectStorage */ - protected $referencesEvents; + protected ObjectStorage $referencesEvents; - /** - * @var int - */ - protected $_languageUid; + protected DataProcessingForModels $dataProcessing; - /** - * @var DataProcessingForModels - */ - protected $dataProcessing; + protected string $sourceName = ''; - /** - * @var string - */ - protected $sourceName = ''; - - /** - * @var string - */ - protected $sourceUrl = ''; + protected string $sourceUrl = ''; public function __construct() { $this->initStorageObjects(); } - /** - * @param DataProcessingForModels $dataProcessing - */ public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing): void { $this->dataProcessing = $dataProcessing; @@ -289,7 +220,7 @@ public function setInstagram(string $instagram): void } /** - * @return ObjectStorage $images + * @return ObjectStorage */ public function getImages(): ObjectStorage { @@ -466,9 +397,7 @@ private function getSortedCategory(ObjectStorage $categories): array { $categories = $categories->toArray(); - usort($categories, function (Category $catA, Category $catB) { - return $catA->getSorting() <=> $catB->getSorting(); - }); + usort($categories, fn (Category $catA, Category $catB) => $catA->getSorting() <=> $catB->getSorting()); return $categories; } diff --git a/Classes/Domain/Model/Import.php b/Classes/Domain/Model/Import.php index 99b23b6..14676e6 100644 --- a/Classes/Domain/Model/Import.php +++ b/Classes/Domain/Model/Import.php @@ -11,83 +11,32 @@ */ class Import extends AbstractDomainObject { - /** - * @var int - */ - protected $storagePid; + protected ?int $categoriesPid; - /** - * @var Folder - */ - protected $filesFolder; - - /** - * @var int|null - */ - protected $categoriesPid; - - /** - * @var Category|null - */ - protected $categoryParent; - - /** - * @var int|null - */ - protected $featuresPid; - - /** - * @var Category|null - */ - protected $featuresParent; - - /** - * @var Region|null - */ - protected $region; - - /** - * @var string - */ - protected $restExperience; - - /** - * @var string - */ - protected $restSearchQuery; + protected ?int $featuresPid; public function __construct( - Folder $filesFolder, - int $storagePid, - string $restExperience, - string $restSearchQuery = '', + protected Folder $filesFolder, + protected int $storagePid, + protected string $restExperience, + protected string $restSearchQuery = '', int $categoriesPid = 0, - ?Category $categoryParent = null, + protected ?Category $categoryParent = null, int $featuresPid = 0, - ?Category $featuresParent = null, - ?Region $region = null + protected ?Category $featuresParent = null, + protected ?Region $region = null ) { - $this->filesFolder = $filesFolder; - $this->storagePid = $storagePid; - // Do not allow categories on pid 0 if ($categoriesPid === 0) { $categoriesPid = null; } $this->categoriesPid = $categoriesPid; - $this->categoryParent = $categoryParent; // Do not allow features on pid 0 if ($featuresPid === 0) { $featuresPid = null; } $this->featuresPid = $featuresPid; - $this->featuresParent = $featuresParent; - - $this->restExperience = $restExperience; - $this->restSearchQuery = $restSearchQuery; - - $this->region = $region; } public function getStoragePid(): int diff --git a/Classes/Domain/Model/Location.php b/Classes/Domain/Model/Location.php index d552b65..003c5a2 100644 --- a/Classes/Domain/Model/Location.php +++ b/Classes/Domain/Model/Location.php @@ -6,75 +6,24 @@ class Location extends AbstractEntity { - /** - * @var string - */ - protected $name = ''; - - /** - * @var string - */ - protected $street = ''; - - /** - * @var string - */ - protected $zip = ''; + protected string $latitude = ''; - /** - * @var string - */ - protected $city = ''; + protected string $longitude = ''; - /** - * @var string - */ - protected $district = ''; - - /** - * @var string - */ - protected $country = ''; - - /** - * @var string - */ - protected $phone = ''; - - /** - * @var string - */ - protected $latitude = ''; - - /** - * @var string - */ - protected $longitude = ''; - - /** - * @var string - */ - protected $globalId = ''; + protected string $globalId = ''; public function __construct( - string $name, - string $street, - string $zip, - string $city, - string $district, - string $country, - string $phone, + protected string $name, + protected string $street, + protected string $zip, + protected string $city, + protected string $district, + protected string $country, + protected string $phone, string $latitude, string $longitude, int $languageUid ) { - $this->name = $name; - $this->street = $street; - $this->zip = $zip; - $this->city = $city; - $this->district = $district; - $this->country = $country; - $this->phone = $phone; $this->latitude = $this->normalizeGeocoordinate($latitude); $this->longitude = $this->normalizeGeocoordinate($longitude); $this->_languageUid = $languageUid; diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index 9567e45..2ba46fa 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -17,50 +17,21 @@ class Organizer extends AbstractEntity { - /** - * @var string - */ - protected $name = ''; - - /** - * @var string - */ - protected $street = ''; - - /** - * @var string - */ - protected $district = ''; - - /** - * @var string - */ - protected $city = ''; - - /** - * @var string - */ - protected $zip = ''; - - /** - * @var string - */ - protected $phone = ''; - - /** - * @var string - */ - protected $web = ''; - - /** - * @var string - */ - protected $email = ''; - - /** - * @var int - */ - protected $_languageUid; + protected string $name = ''; + + protected string $street = ''; + + protected string $district = ''; + + protected string $city = ''; + + protected string $zip = ''; + + protected string $phone = ''; + + protected string $web = ''; + + protected string $email = ''; public function getName(): string { diff --git a/Classes/Domain/Model/Partner.php b/Classes/Domain/Model/Partner.php index 3b6bf1c..438faf2 100644 --- a/Classes/Domain/Model/Partner.php +++ b/Classes/Domain/Model/Partner.php @@ -27,20 +27,14 @@ class Partner extends AbstractEntity { - /** - * @var string - */ - protected $title = ''; + protected string $title = ''; - /** - * @var string - */ - protected $link = ''; + protected string $link = ''; /** * @var ObjectStorage */ - protected $images; + protected ObjectStorage $images; public function getTitle(): string { diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php index 020fac9..2da532d 100644 --- a/Classes/Domain/Model/Region.php +++ b/Classes/Domain/Model/Region.php @@ -17,15 +17,7 @@ class Region extends AbstractEntity { - /** - * @var string - */ - protected $title = ''; - - /** - * @var int - */ - protected $_languageUid; + protected string $title = ''; public function getTitle(): string { diff --git a/Classes/Domain/Repository/CategoryRepository.php b/Classes/Domain/Repository/CategoryRepository.php index 423a5ab..b582b1c 100644 --- a/Classes/Domain/Repository/CategoryRepository.php +++ b/Classes/Domain/Repository/CategoryRepository.php @@ -88,7 +88,7 @@ public function findAllCurrentlyAssigned( return $this->dataMapper->map( Category::class, - $qb->execute()->fetchAll() + $qb->executeQuery()->fetchAll() ); } @@ -105,10 +105,10 @@ public function findOneForImport( $query->getQuerySettings()->setIgnoreEnableFields(true); $query->getQuerySettings()->setEnableFieldsToBeIgnored(['disabled']); - $query->matching($query->logicalAnd([ + $query->matching($query->logicalAnd( $query->equals('parent', $parentCategory), $query->equals('title', $title), - ])); + )); $query->setLimit(1); diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index fa475c1..43a08ca 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -95,27 +95,27 @@ protected function createDemandQuery(DateDemand $demand): QueryInterface $now = $now->modify('midnight'); } - $constraints['nowAndFuture'] = $query->logicalOr([ + $constraints['nowAndFuture'] = $query->logicalOr( $query->greaterThanOrEqual('start', $now), $query->greaterThanOrEqual('end', $now), - ]); + ); } elseif ($demand->shouldShowUpcoming()) { $now = $this->getNow(); - $constraints['future'] = $query->logicalAnd([ + $constraints['future'] = $query->logicalAnd( $query->greaterThan('start', $now), - $query->logicalOr([ + $query->logicalOr( $query->equals('end', 0), $query->greaterThan('end', $now), - ]), - ]); + ), + ); } if ($demand->getLimit() !== '') { $query->setLimit((int)$demand->getLimit()); } - $query->matching($query->logicalAnd($constraints)); + $query->matching($query->logicalAnd(... $constraints)); if ($demand->getSortBy() && $demand->getSortOrder()) { $query->setOrderings([$demand->getSortBy() => $demand->getSortOrder()]); @@ -146,7 +146,7 @@ private function getSearchwordConstraint( $wordsToSearch[] = $demand->getSearchword(); $constraints = []; - $queryBuilder = $this->objectManager->get(ConnectionPool::class) + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('tx_events_domain_model_date'); foreach ($wordsToSearch as $word) { @@ -155,7 +155,7 @@ private function getSearchwordConstraint( } } - return $query->logicalOr($constraints); + return $query->logicalOr(... $constraints); } protected function createCategoryConstraint( @@ -183,10 +183,10 @@ protected function createCategoryConstraint( } if ($demand->getCategoryCombination() === 'or') { - return $query->logicalOr($constraints); + return $query->logicalOr(... $constraints); } - return $query->logicalAnd($constraints); + return $query->logicalAnd(... $constraints); } private function createTimingConstraint( @@ -196,42 +196,42 @@ private function createTimingConstraint( // Dates might have end of 0 if only start exists. if ($demand->getStartObject() !== null && $demand->getEndObject() === null) { - return $query->logicalOr([ + return $query->logicalOr( $query->greaterThanOrEqual('start', $demand->getStartObject()), $query->greaterThanOrEqual('end', $demand->getStartObject()), - ]); + ); } if ($demand->getStartObject() === null && $demand->getEndObject() !== null) { - return $query->logicalOr([ - $query->logicalAnd([ + return $query->logicalOr( + $query->logicalAnd( $query->lessThanOrEqual('end', $demand->getEndObject()), $query->greaterThan('end', 0), - ]), + ), $query->lessThanOrEqual('start', $demand->getEndObject()), - ]); + ); } if ($demand->getStartObject() !== null && $demand->getEndObject() !== null) { - return $query->logicalOr([ - $query->logicalAnd([ - $query->logicalOr([ + return $query->logicalOr( + $query->logicalAnd( + $query->logicalOr( $query->greaterThanOrEqual('start', $demand->getStartObject()), $query->greaterThanOrEqual('end', $demand->getStartObject()), - ]), - $query->logicalOr([ + ), + $query->logicalOr( $query->lessThanOrEqual('start', $demand->getEndObject()), - $query->logicalAnd([ + $query->logicalAnd( $query->lessThanOrEqual('end', $demand->getEndObject()), $query->greaterThan('end', 0), - ]), - ]), - ]), - $query->logicalAnd([ + ), + ), + ), + $query->logicalAnd( $query->lessThanOrEqual('start', $demand->getStartObject()), $query->greaterThanOrEqual('end', $demand->getEndObject()), - ]), - ]); + ), + ); } return null; @@ -247,7 +247,7 @@ private function createFeaturesConstraint( $constraints[] = $query->contains('event.features', $feature); } - return $query->logicalAnd($constraints); + return $query->logicalAnd(... $constraints); } public function findSearchWord(string $search): array @@ -272,7 +272,7 @@ public function findSearchWord(string $search): array $queryBuilder->expr()->like('event.title', $queryBuilder->createNamedParameter('%' . $search . '%')) )->orderBy('tx_events_domain_model_date.start'); - return $statement->execute()->fetchAll(); + return $statement->executeQuery()->fetchAll(); } private function createEventConstraint( diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index 8628436..79d2f4e 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -55,7 +55,7 @@ protected function createDemandQuery(EventDemand $demand): QueryInterface $constraints = $this->getConstraints($query, $demand); if (!empty($constraints)) { - $query->matching($query->logicalAnd($constraints)); + $query->matching($query->logicalAnd(... $constraints)); } if ($demand->getLimit() !== '') { @@ -148,9 +148,9 @@ protected function createCategoryConstraint(QueryInterface $query, EventDemand $ } if ($demand->getCategoryCombination() === 'or') { - return $query->logicalOr($constraints); + return $query->logicalOr(... $constraints); } - return $query->logicalAnd($constraints); + return $query->logicalAnd(... $constraints); } public function findSearchWord(string $search): QueryResult diff --git a/Classes/Events/Controller/DateListVariables.php b/Classes/Events/Controller/DateListVariables.php index d18a72f..9bdde94 100644 --- a/Classes/Events/Controller/DateListVariables.php +++ b/Classes/Events/Controller/DateListVariables.php @@ -9,41 +9,17 @@ final class DateListVariables { - /** - * @var array - */ - private $search; - - /** - * @var DateDemand - */ - private $demand; - - /** - * @var QueryResult - */ - private $dates; - - /** - * @var PaginationInterface - */ - private $pagination; - - /** - * @var array - */ - private $variables = []; + private array $variables = []; public function __construct( - array $search, - DateDemand $demand, - QueryResult $dates, - PaginationInterface $pagination + private readonly array $search, + private readonly DateDemand $demand, + /** + * @var QueryResult + */ + private readonly QueryResult $dates, + private readonly PaginationInterface $pagination ) { - $this->search = $search; - $this->demand = $demand; - $this->dates = $dates; - $this->pagination = $pagination; } public function getSearch(): array @@ -64,21 +40,13 @@ public function getDates(): QueryResult return $this->dates; } - /** - * @param mixed $value - */ - public function addVariable(string $key, $value): void + public function addVariable(string $key, mixed $value): void { $this->variables[$key] = $value; } public function getVariablesForView(): array { - return array_merge([ - 'search' => $this->search, - 'demand' => $this->demand, - 'dates' => $this->dates, - 'pagination' => $this->pagination, - ], $this->variables); + return ['search' => $this->search, 'demand' => $this->demand, 'dates' => $this->dates, 'pagination' => $this->pagination, ...$this->variables]; } } diff --git a/Classes/Events/Controller/DateSearchVariables.php b/Classes/Events/Controller/DateSearchVariables.php index 610031c..1496710 100644 --- a/Classes/Events/Controller/DateSearchVariables.php +++ b/Classes/Events/Controller/DateSearchVariables.php @@ -2,58 +2,27 @@ namespace WerkraumMedia\Events\Events\Controller; -use TYPO3\CMS\Extbase\Domain\Model\Category; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; +use WerkraumMedia\Events\Domain\Model\Category; use WerkraumMedia\Events\Domain\Model\Dto\DateDemand; use WerkraumMedia\Events\Domain\Model\Region; class DateSearchVariables { - /** - * @var array - */ - private $search; - - /** - * @var DateDemand - */ - private $demand; - - /** - * @var QueryResultInterface - */ - private $regions; - - /** - * @var array - */ - private $categories; - - /** - * @var array - */ - private $features; - - /** - * @var array - */ - private $variables = []; + private array $variables = []; /** * @param QueryResultInterface $regions + * @param array $categories + * @param array $features */ public function __construct( - array $search, - DateDemand $demand, - QueryResultInterface $regions, - array $categories, - array $features + private readonly array $search, + private readonly DateDemand $demand, + private readonly QueryResultInterface $regions, + private readonly array $categories, + private readonly array $features ) { - $this->search = $search; - $this->demand = $demand; - $this->regions = $regions; - $this->categories = $categories; - $this->features = $features; } public function getSearch(): array @@ -84,22 +53,13 @@ public function getFeatures(): array return $this->features; } - /** - * @param mixed $value - */ - public function addVariable(string $key, $value): void + public function addVariable(string $key, mixed $value): void { $this->variables[$key] = $value; } public function getVariablesForView(): array { - return array_merge([ - 'search' => $this->search, - 'demand' => $this->demand, - 'regions' => $this->regions, - 'categories' => $this->categories, - 'features' => $this->features, - ], $this->variables); + return ['search' => $this->search, 'demand' => $this->demand, 'regions' => $this->regions, 'categories' => $this->categories, 'features' => $this->features, ...$this->variables]; } } diff --git a/Classes/Extbase/AddSpecialProperties.php b/Classes/Extbase/AddSpecialProperties.php index e2a8d97..0232df0 100644 --- a/Classes/Extbase/AddSpecialProperties.php +++ b/Classes/Extbase/AddSpecialProperties.php @@ -28,35 +28,20 @@ class AddSpecialProperties { - /** - * @var ConnectionPool - */ - private $connectionPool; - - /** - * @var DataMapper - */ - private $dataMapper; - /** * Internal info to speed things up if we know there are none. - * - * @var bool */ - private $doPostponedDatesExist = true; + private bool $doPostponedDatesExist = true; public function __construct( - ConnectionPool $connectionPool, - DataMapper $dataMapper + private readonly ConnectionPool $connectionPool, + private readonly DataMapper $dataMapper ) { - $this->connectionPool = $connectionPool; - $this->dataMapper = $dataMapper; - $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_date'); $qb->count('uid'); $qb->from('tx_events_domain_model_date'); $qb->where($qb->expr()->gt('postponed_date', $qb->createNamedParameter(0))); - $this->doPostponedDatesExist = $qb->execute()->fetchColumn() > 0; + $this->doPostponedDatesExist = $qb->executeQuery()->fetchOne() > 0; } public function __invoke(AfterObjectThawedEvent $event): void @@ -85,7 +70,7 @@ private function getOriginalDate(int $uidOfReferencedDate): ?Date $qb->where($qb->expr()->eq('postponed_date', $uidOfReferencedDate)); $qb->setMaxResults(1); - $result = $qb->execute()->fetch(); + $result = $qb->executeQuery()->fetch(); if ($result === false) { return null; diff --git a/Classes/Pagination/Factory.php b/Classes/Pagination/Factory.php index b61ca26..c19a0c9 100644 --- a/Classes/Pagination/Factory.php +++ b/Classes/Pagination/Factory.php @@ -5,9 +5,9 @@ namespace WerkraumMedia\Events\Pagination; use TYPO3\CMS\Core\Pagination\PaginationInterface; +use TYPO3\CMS\Core\Pagination\SlidingWindowPagination; use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; -use WerkraumMedia\Events\Backports\V12\Pagination\SlidingWindowPagination; class Factory { diff --git a/Classes/Service/CategoryService.php b/Classes/Service/CategoryService.php index e24c56e..02e082c 100644 --- a/Classes/Service/CategoryService.php +++ b/Classes/Service/CategoryService.php @@ -28,7 +28,6 @@ public function __construct() * and using the caching framework to save some queries * * @param string $idList list of category ids to start - * @param int $counter * * @return string comma separated list of category ids */ @@ -69,12 +68,10 @@ protected function getChildrenCategoriesRecursive($idList, $counter = 0): string ->getQueryBuilderForTable('sys_category'); $res = $queryBuilder ->select('uid') - ->from('sys_category') - ->where($queryBuilder->expr()->in( + ->from('sys_category')->where($queryBuilder->expr()->in( 'parent', $queryBuilder->createNamedParameter(explode(',', $idList), Connection::PARAM_INT_ARRAY) - )) - ->execute(); + ))->executeQuery(); while ($row = $res->fetch()) { if (is_array($row) === false) { @@ -97,7 +94,6 @@ protected function getChildrenCategoriesRecursive($idList, $counter = 0): string /** * Fetch ids again from DB to avoid false positives * - * @param string $idList * * @return string */ @@ -108,12 +104,10 @@ protected function getUidListFromRecords(string $idList): string ->getQueryBuilderForTable('sys_category'); $rows = $queryBuilder ->select('uid') - ->from('sys_category') - ->where($queryBuilder->expr()->in( + ->from('sys_category')->where($queryBuilder->expr()->in( 'uid', $queryBuilder->createNamedParameter(explode(',', $idList), Connection::PARAM_INT_ARRAY) - )) - ->execute() + ))->executeQuery() ->fetchAll(); foreach ($rows as $row) { if (is_array($row) === false) { diff --git a/Classes/Service/Cleanup/Database.php b/Classes/Service/Cleanup/Database.php index f675925..ecf1876 100644 --- a/Classes/Service/Cleanup/Database.php +++ b/Classes/Service/Cleanup/Database.php @@ -21,24 +21,20 @@ * 02110-1301, USA. */ +use DateTimeImmutable; +use PDO; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; class Database { - /** - * @var ConnectionPool - */ - private $connectionPool; - private const DATE_TABLE = 'tx_events_domain_model_date'; private const EVENT_TABLE = 'tx_events_domain_model_event'; private const ORGANIZER_TABLE = 'tx_events_domain_model_organizer'; public function __construct( - ConnectionPool $connectionPool + private readonly ConnectionPool $connectionPool ) { - $this->connectionPool = $connectionPool; } public function truncateTables(): void @@ -55,12 +51,10 @@ public function truncateTables(): void ->truncate($tableName); } $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_category_record_mm'); - $queryBuilder->delete('sys_category_record_mm') - ->where($queryBuilder->expr()->like( - 'tablenames', - $queryBuilder->createNamedParameter('tx_events_domain_model_%') - )) - ->execute(); + $queryBuilder->delete('sys_category_record_mm')->where($queryBuilder->expr()->like( + 'tablenames', + $queryBuilder->createNamedParameter('tx_events_domain_model_%') + ))->executeStatement(); } public function deletePastDates(): void @@ -71,13 +65,11 @@ public function deletePastDates(): void $queryBuilder->getRestrictions()->removeAll(); - $midnightToday = new \DateTimeImmutable('midnight today'); - $queryBuilder->delete(self::DATE_TABLE) - ->where($queryBuilder->expr()->lte( - 'end', - $queryBuilder->createNamedParameter($midnightToday->format('U')) - )) - ->execute(); + $midnightToday = new DateTimeImmutable('midnight today'); + $queryBuilder->delete(self::DATE_TABLE)->where($queryBuilder->expr()->lte( + 'end', + $queryBuilder->createNamedParameter($midnightToday->format('U')) + ))->executeStatement(); } public function deleteEventsWithoutDates(): void @@ -90,10 +82,8 @@ public function deleteEventsWithoutDates(): void $recordUids = $queryBuilder->select('event.uid') ->from(self::EVENT_TABLE, 'event') - ->leftJoin('event', self::DATE_TABLE, 'date', $queryBuilder->expr()->eq('date.event', 'event.uid')) - ->where($queryBuilder->expr()->isNull('date.uid')) - ->execute() - ->fetchAll(\PDO::FETCH_COLUMN); + ->leftJoin('event', self::DATE_TABLE, 'date', $queryBuilder->expr()->eq('date.event', 'event.uid'))->where($queryBuilder->expr()->isNull('date.uid'))->executeQuery() + ->fetchAll(PDO::FETCH_COLUMN); $queryBuilder = $this->connectionPool->getQueryBuilderForTable(self::EVENT_TABLE); $queryBuilder->delete(self::EVENT_TABLE); @@ -101,20 +91,15 @@ public function deleteEventsWithoutDates(): void 'uid', $queryBuilder->createNamedParameter($recordUids, Connection::PARAM_INT_ARRAY) )); - $queryBuilder->execute(); + $queryBuilder->executeStatement(); $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_category_record_mm'); - $queryBuilder->delete('sys_category_record_mm') - ->where($queryBuilder->expr()->andX( - $queryBuilder->expr()->like( - 'tablenames', - $queryBuilder->createNamedParameter('tx_events_domain_model_%') - ), - $queryBuilder->expr()->in( - 'uid_foreign', - $queryBuilder->createNamedParameter($recordUids, Connection::PARAM_INT_ARRAY) - ) - )) - ->execute(); + $queryBuilder->delete('sys_category_record_mm')->where($queryBuilder->expr()->and($queryBuilder->expr()->like( + 'tablenames', + $queryBuilder->createNamedParameter('tx_events_domain_model_%') + ), $queryBuilder->expr()->in( + 'uid_foreign', + $queryBuilder->createNamedParameter($recordUids, Connection::PARAM_INT_ARRAY) + )))->executeStatement(); } } diff --git a/Classes/Service/Cleanup/Files.php b/Classes/Service/Cleanup/Files.php index 45171ac..3562b12 100644 --- a/Classes/Service/Cleanup/Files.php +++ b/Classes/Service/Cleanup/Files.php @@ -21,28 +21,17 @@ * 02110-1301, USA. */ +use PDO; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Resource\StorageRepository; class Files { - /** - * @var ConnectionPool - */ - private $connectionPool; - - /** - * @var StorageRepository - */ - private $storageRepository; - public function __construct( - ConnectionPool $connectionPool, - StorageRepository $storageRepository + private readonly ConnectionPool $connectionPool, + private readonly StorageRepository $storageRepository ) { - $this->connectionPool = $connectionPool; - $this->storageRepository = $storageRepository; } public function deleteDangling(): void @@ -70,29 +59,24 @@ private function markFileReferencesDeletedIfForeignRecordIsMissing(): void ); // Remove file relations removed via import $referencesQuery->orWhere( - $referencesQuery->expr()->andX( - $referencesQuery->expr()->eq( - 'tablenames', - $referencesQuery->createNamedParameter('') - ), - $referencesQuery->expr()->eq( - 'fieldname', - $referencesQuery->createNamedParameter('') - ), - $referencesQuery->expr()->eq( - 'sorting_foreign', - $referencesQuery->createNamedParameter('0') - ), - $referencesQuery->expr()->eq( - 'uid_foreign', - $referencesQuery->createNamedParameter('0') - ) - ) + $referencesQuery->expr()->and($referencesQuery->expr()->eq( + 'tablenames', + $referencesQuery->createNamedParameter('') + ), $referencesQuery->expr()->eq( + 'fieldname', + $referencesQuery->createNamedParameter('') + ), $referencesQuery->expr()->eq( + 'sorting_foreign', + $referencesQuery->createNamedParameter('0') + ), $referencesQuery->expr()->eq( + 'uid_foreign', + $referencesQuery->createNamedParameter('0') + )) ); $referencesQuery->orderBy('tablenames'); $referencesQuery->addOrderBy('uid_foreign'); - $references = $referencesQuery->execute(); + $references = $referencesQuery->executeQuery(); $uidsPerTable = []; $referenceUidsToMarkAsDeleted = []; @@ -116,10 +100,7 @@ private function markFileReferencesDeletedIfForeignRecordIsMissing(): void $queryBuilder->select('uid'); $queryBuilder->from($tableName); $queryBuilder->where($queryBuilder->expr()->in('uid', $records)); - $referenceUidsToMarkAsDeleted = array_merge( - $referenceUidsToMarkAsDeleted, - array_keys(array_diff($records, $queryBuilder->execute()->fetchAll(\PDO::FETCH_COLUMN))) - ); + $referenceUidsToMarkAsDeleted = [...$referenceUidsToMarkAsDeleted, ...array_keys(array_diff($records, $queryBuilder->executeQuery()->fetchAll(PDO::FETCH_COLUMN)))]; } if ($referenceUidsToMarkAsDeleted === []) { @@ -130,7 +111,7 @@ private function markFileReferencesDeletedIfForeignRecordIsMissing(): void $updateQuery->update('sys_file_reference'); $updateQuery->where($updateQuery->expr()->in('uid', $referenceUidsToMarkAsDeleted)); $updateQuery->set('deleted', '1'); - $updateQuery->execute(); + $updateQuery->executeStatement(); } private function deleteFilesWithoutProperReference(): void @@ -160,14 +141,16 @@ private function deleteFromDb(int ...$uids): void $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_file'); $queryBuilder->delete('sys_file') ->where('uid in (:uids)') - ->setParameter(':uids', $uids, Connection::PARAM_INT_ARRAY) - ->execute(); + ->setParameter('uids', $uids, Connection::PARAM_INT_ARRAY) + ->executeStatement() + ; $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_file_metadata'); $queryBuilder->delete('sys_file_metadata') ->where('file in (:uids)') - ->setParameter(':uids', $uids, Connection::PARAM_INT_ARRAY) - ->execute(); + ->setParameter('uids', $uids, Connection::PARAM_INT_ARRAY) + ->executeStatement() + ; $this->deleteReferences(); } @@ -179,23 +162,20 @@ private function deleteReferences(): void $queryBuilder ->delete('sys_file_reference') ->where( - $queryBuilder->expr()->orX( - $queryBuilder->expr()->like( - 'tablenames', - $queryBuilder->createNamedParameter('tx_events_domain_model_%') - ), - $queryBuilder->expr()->eq( - 'tablenames', - $queryBuilder->createNamedParameter('') - ) - ) + $queryBuilder->expr()->or($queryBuilder->expr()->like( + 'tablenames', + $queryBuilder->createNamedParameter('tx_events_domain_model_%') + ), $queryBuilder->expr()->eq( + 'tablenames', + $queryBuilder->createNamedParameter('') + )) ) ->andWhere($queryBuilder->expr()->eq( 'deleted', 1 )) ; - $queryBuilder->execute(); + $queryBuilder->executeStatement(); } /** @@ -225,7 +205,7 @@ private function getPotentialFilesToDelete(): array ->groupBy('file.uid') ; - return $queryBuilder->execute()->fetchAllAssociativeIndexed(); + return $queryBuilder->executeQuery()->fetchAllAssociativeIndexed(); } /** @@ -249,13 +229,13 @@ private function filterPotentialFilesToDelete(array $files): array )) ; - foreach ($queryBuilder->execute() as $reference) { + foreach ($queryBuilder->executeQuery()->iterateAssociative() as $reference) { $file = []; $fileUid = (int)$reference['uid_local']; if ( ( - str_starts_with($reference['tablenames'], 'tx_events_domain_model_') + str_starts_with((string)$reference['tablenames'], 'tx_events_domain_model_') || $reference['tablenames'] === '' ) && $reference['deleted'] == 1 ) { diff --git a/Classes/Service/CleanupService.php b/Classes/Service/CleanupService.php index 7efb28e..51ce9ce 100644 --- a/Classes/Service/CleanupService.php +++ b/Classes/Service/CleanupService.php @@ -7,20 +7,10 @@ class CleanupService { - /** - * @var Database - */ - private $database; - - /** - * @var Files - */ - private $files; - - public function __construct(Database $database, Files $files) - { - $this->database = $database; - $this->files = $files; + public function __construct( + private readonly Database $database, + private readonly Files $files + ) { } public function deleteAllData(): void diff --git a/Classes/Service/DataProcessingForModels.php b/Classes/Service/DataProcessingForModels.php index 15cca77..b96e825 100644 --- a/Classes/Service/DataProcessingForModels.php +++ b/Classes/Service/DataProcessingForModels.php @@ -21,7 +21,6 @@ * 02110-1301, USA. */ -use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\TypoScript\TypoScriptService; @@ -72,44 +71,20 @@ class DataProcessingForModels implements SingletonInterface /** * @var ContentObjectRenderer */ - private $cObject; + private readonly object $cObject; - /** - * @var ContentDataProcessor - */ - private $processorHandler; + private readonly \TYPO3\CMS\Core\Database\Connection $connection; - /** - * @var Connection - */ - private $connection; - - /** - * @var DataMapFactory - */ - private $dataMapFactory; - - /** - * @var ConfigurationManagerInterface|null - */ - private $configurationManager; - - /** - * @var TypoScriptService - */ - private $typoScriptService; + private ?\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager = null; public function __construct( - ContentDataProcessor $processorHandler, + private readonly ContentDataProcessor $processorHandler, ConnectionPool $connectionPool, - DataMapFactory $dataMapFactory, - TypoScriptService $typoScriptService + private readonly DataMapFactory $dataMapFactory, + private readonly TypoScriptService $typoScriptService ) { $this->cObject = GeneralUtility::makeInstance(ContentObjectRenderer::class); - $this->processorHandler = $processorHandler; $this->connection = $connectionPool->getConnectionByName('Default'); - $this->dataMapFactory = $dataMapFactory; - $this->typoScriptService = $typoScriptService; } /** @@ -148,7 +123,7 @@ private function getData(AbstractEntity $entity): array private function getTable(AbstractEntity $entity): string { - $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity)); + $dataMap = $this->dataMapFactory->buildDataMap($entity::class); return $dataMap->getTableName(); } @@ -158,7 +133,7 @@ private function getConfiguration(AbstractEntity $entity): array return []; } - $className = get_class($entity); + $className = $entity::class; $settings = $this->configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS ); diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index e10e561..ee36dab 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -9,7 +9,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use WerkraumMedia\Events\Caching\CacheManager; use WerkraumMedia\Events\Domain\Model\Event; @@ -33,146 +32,34 @@ class DestinationDataImportService { - /** - * @var Import - */ - private $import; + private Import $import; - /** - * @var Event - */ - private $tmpCurrentEvent; + private Event $tmpCurrentEvent; /** * @var Logger */ private $logger; - /** - * @var EventRepository - */ - private $eventRepository; - - /** - * @var OrganizerRepository - */ - private $organizerRepository; - - /** - * @var DateRepository - */ - private $dateRepository; - - /** - * @var ConfigurationManager - */ - private $configurationManager; - - /** - * @var ObjectManager - */ - private $objectManager; - - /** - * @var PersistenceManager - */ - private $persistenceManager; - - /** - * @var DataFetcher - */ - private $dataFetcher; - - /** - * @var DatesFactory - */ - private $datesFactory; - - /** - * @var FilesAssignment - */ - private $filesAssignment; - - /** - * @var CategoriesAssignment - */ - private $categoriesAssignment; - - /** - * @var LocationAssignment - */ - private $locationAssignment; - - /** - * @var Slugger - */ - private $slugger; - - /** - * @var CacheManager - */ - private $cacheManager; - - /** - * @var DataHandler - */ - private $dataHandler; - - /** - * @var EventDispatcher - */ - private $eventDispatcher; - /** * ImportService constructor. - * - * @param EventRepository $eventRepository - * @param OrganizerRepository $organizerRepository - * @param DateRepository $dateRepository - * @param ConfigurationManager $configurationManager - * @param PersistenceManager $persistenceManager - * @param ObjectManager $objectManager - * @param DataFetcher $dataFetcher - * @param FilesAssignment $filesAssignment - * @param CategoriesAssignment $categoriesAssignment - * @param LocationAssignment $locationAssignment - * @param Slugger $slugger - * @param CacheManager $cacheManager - * @param DataHandler $dataHandler - * @param EventDispatcher $eventDispatcher */ public function __construct( - EventRepository $eventRepository, - OrganizerRepository $organizerRepository, - DateRepository $dateRepository, - ConfigurationManager $configurationManager, - PersistenceManager $persistenceManager, - ObjectManager $objectManager, - DataFetcher $dataFetcher, - DatesFactory $datesFactory, - FilesAssignment $filesAssignment, - CategoriesAssignment $categoriesAssignment, - LocationAssignment $locationAssignment, - Slugger $slugger, - CacheManager $cacheManager, - DataHandler $dataHandler, - EventDispatcher $eventDispatcher + private readonly EventRepository $eventRepository, + private readonly OrganizerRepository $organizerRepository, + private readonly DateRepository $dateRepository, + private readonly ConfigurationManager $configurationManager, + private readonly PersistenceManager $persistenceManager, + private readonly DataFetcher $dataFetcher, + private readonly DatesFactory $datesFactory, + private readonly FilesAssignment $filesAssignment, + private readonly CategoriesAssignment $categoriesAssignment, + private readonly LocationAssignment $locationAssignment, + private readonly Slugger $slugger, + private readonly CacheManager $cacheManager, + private readonly DataHandler $dataHandler, + private readonly EventDispatcher $eventDispatcher ) { - $this->eventRepository = $eventRepository; - $this->organizerRepository = $organizerRepository; - $this->dateRepository = $dateRepository; - $this->configurationManager = $configurationManager; - $this->persistenceManager = $persistenceManager; - $this->objectManager = $objectManager; - $this->dataFetcher = $dataFetcher; - $this->datesFactory = $datesFactory; - $this->filesAssignment = $filesAssignment; - $this->categoriesAssignment = $categoriesAssignment; - $this->locationAssignment = $locationAssignment; - $this->slugger = $slugger; - $this->cacheManager = $cacheManager; - $this->dataHandler = $dataHandler; - $this->eventDispatcher = $eventDispatcher; } public function import( @@ -194,12 +81,12 @@ public function import( // Set Configuration $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration)); - $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); + $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(self::class); $this->logger->info('Starting Destination Data Import Service'); try { $data = $this->dataFetcher->fetchSearchResult($import); - } catch (Exception $e) { + } catch (Exception) { $this->logger->error('Could not receive data.'); return 1; } @@ -215,7 +102,7 @@ public function processData(array $data): int $selectedRegion = $this->import->getRegion(); foreach ($data['items'] as $event) { - $this->logger->info('Processing event ' . substr($event['title'], 0, 20)); + $this->logger->info('Processing event ' . substr((string)$event['title'], 0, 20)); // Event already exists? If not create one! $this->tmpCurrentEvent = $this->getOrCreateEvent($event['global_id'], $event['title']); @@ -230,7 +117,7 @@ public function processData(array $data): int } // Set Title - $this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254)); + $this->tmpCurrentEvent->setTitle(substr((string)$event['title'], 0, 254)); // Set Highlight (Is only set in rest if true) if ($event['highlight'] ?? false) { @@ -382,7 +269,7 @@ private function setOrganizer(array $addresses): void $this->tmpCurrentEvent->setOrganizer($tmpOrganizer); continue; } - $tmpOrganizer = $this->objectManager->get(Organizer::class); + $tmpOrganizer = GeneralUtility::makeInstance(Organizer::class); $tmpOrganizer->setLanguageUid(-1); $tmpOrganizer->setName($address['name'] ?? ''); $tmpOrganizer->setCity($address['city'] ?? ''); @@ -398,9 +285,6 @@ private function setOrganizer(array $addresses): void } } - /** - * @param array $media - */ private function setSocial(array $media): void { foreach ($media as $link) { @@ -470,13 +354,13 @@ private function setTexts(array $texts): void } if ($text['rel'] == 'details' && $text['type'] == 'text/plain') { - $this->tmpCurrentEvent->setDetails(str_replace("\n\n", "\n", $text['value'])); + $this->tmpCurrentEvent->setDetails(str_replace("\n\n", "\n", (string)$text['value'])); } if ($text['rel'] == 'teaser' && $text['type'] == 'text/plain') { - $this->tmpCurrentEvent->setTeaser(str_replace("\n\n", "\n", $text['value'])); + $this->tmpCurrentEvent->setTeaser(str_replace("\n\n", "\n", (string)$text['value'])); } if ($text['rel'] == 'PRICE_INFO' && $text['type'] == 'text/plain') { - $this->tmpCurrentEvent->setPriceInfo(str_replace("\n\n", "\n", $text['value'])); + $this->tmpCurrentEvent->setPriceInfo(str_replace("\n\n", "\n", (string)$text['value'])); } } } @@ -494,7 +378,7 @@ private function getOrCreateEvent(string $globalId, string $title): Event // New event is created $this->logger->info(substr($title, 0, 20) . ' does not exist'); - $event = $this->objectManager->get(Event::class); + $event = GeneralUtility::makeInstance(Event::class); // Create event and persist $event->setGlobalId($globalId); $this->eventRepository->add($event); diff --git a/Classes/Service/DestinationDataImportService/CategoriesAssignment.php b/Classes/Service/DestinationDataImportService/CategoriesAssignment.php index 660362d..f0d542c 100644 --- a/Classes/Service/DestinationDataImportService/CategoriesAssignment.php +++ b/Classes/Service/DestinationDataImportService/CategoriesAssignment.php @@ -16,22 +16,10 @@ */ class CategoriesAssignment { - /** - * @var CategoryRepository - */ - private $repository; - - /** - * @var PersistenceManager - */ - private $persistenceManager; - public function __construct( - CategoryRepository $repository, - PersistenceManager $persistenceManager + private readonly CategoryRepository $repository, + private readonly PersistenceManager $persistenceManager ) { - $this->repository = $repository; - $this->persistenceManager = $persistenceManager; } /** diff --git a/Classes/Service/DestinationDataImportService/CategoriesAssignment/Import.php b/Classes/Service/DestinationDataImportService/CategoriesAssignment/Import.php index 4027988..1b05ff4 100644 --- a/Classes/Service/DestinationDataImportService/CategoriesAssignment/Import.php +++ b/Classes/Service/DestinationDataImportService/CategoriesAssignment/Import.php @@ -6,36 +6,12 @@ class Import { - /** - * @var Category|null - */ - private $parentCategory; - - /** - * @var int|null - */ - private $pid; - - /** - * @var array - */ - private $categoryTitles; - - /** - * @var bool - */ - private $hideByDefault; - public function __construct( - ?Category $parentCategory, - ?int $pid, - array $categoryTitles, - bool $hideByDefault = false + private readonly ?Category $parentCategory, + private readonly ?int $pid, + private readonly array $categoryTitles, + private readonly bool $hideByDefault = false ) { - $this->parentCategory = $parentCategory; - $this->pid = $pid; - $this->categoryTitles = $categoryTitles; - $this->hideByDefault = $hideByDefault; } public function getParentCategory(): ?Category diff --git a/Classes/Service/DestinationDataImportService/DataFetcher.php b/Classes/Service/DestinationDataImportService/DataFetcher.php index fedce0d..b30f708 100644 --- a/Classes/Service/DestinationDataImportService/DataFetcher.php +++ b/Classes/Service/DestinationDataImportService/DataFetcher.php @@ -2,6 +2,7 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService; +use Exception; use GuzzleHttp\ClientInterface as GuzzleClientInterface; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; @@ -18,37 +19,18 @@ */ class DataFetcher { - /** - * @var UrlFactory - */ - private $urlFactory; - - /** - * @var RequestFactoryInterface - */ - private $requestFactory; - - /** - * @var GuzzleClientInterface - */ - private $client; - /** * @var Logger */ - private $logger; + private readonly \Psr\Log\LoggerInterface $logger; public function __construct( - UrlFactory $urlFactory, + private readonly UrlFactory $urlFactory, LogManager $logManager, - RequestFactoryInterface $requestFactory, - GuzzleClientInterface $client + private readonly RequestFactoryInterface $requestFactory, + private readonly GuzzleClientInterface $client ) { - $this->urlFactory = $urlFactory; - $this->requestFactory = $requestFactory; - $this->client = $client; - - $this->logger = $logManager->getLogger(__CLASS__); + $this->logger = $logManager->getLogger(self::class); } public function fetchSearchResult(Import $import): array @@ -76,9 +58,9 @@ public function fetchSearchResult(Import $import): array $jsonContent = $response->getBody()->__toString(); - $jsonResponse = json_decode($jsonContent, true); + $jsonResponse = json_decode($jsonContent, true, 512, JSON_THROW_ON_ERROR); if (is_array($jsonResponse) === false) { - throw new \Exception('No valid JSON fetched, got: "' . $jsonContent . '".', 1639495835); + throw new Exception('No valid JSON fetched, got: "' . $jsonContent . '".', 1639495835); } $this->logger->info('Received data with ' . count($jsonResponse['items']) . ' items'); diff --git a/Classes/Service/DestinationDataImportService/DataHandler.php b/Classes/Service/DestinationDataImportService/DataHandler.php index 0cab0ab..31b9100 100644 --- a/Classes/Service/DestinationDataImportService/DataHandler.php +++ b/Classes/Service/DestinationDataImportService/DataHandler.php @@ -34,12 +34,12 @@ final class DataHandler /** * @var Logger */ - private $logger; + private readonly \Psr\Log\LoggerInterface $logger; public function __construct( LogManager $logManager ) { - $this->logger = $logManager->getLogger(__CLASS__); + $this->logger = $logManager->getLogger(self::class); } public function storeAssignments( diff --git a/Classes/Service/DestinationDataImportService/DataHandler/Assignment.php b/Classes/Service/DestinationDataImportService/DataHandler/Assignment.php index 9202b0d..1560c84 100644 --- a/Classes/Service/DestinationDataImportService/DataHandler/Assignment.php +++ b/Classes/Service/DestinationDataImportService/DataHandler/Assignment.php @@ -28,31 +28,26 @@ final class Assignment { - /** - * @var int - */ - private $uid; - - /** - * @var string - */ - private $columnName; + private readonly int $uid; /** * @var int[] */ - private $uids; + private readonly array $uids; /** * @param AbstractDomainObject[] $assignments */ public function __construct( - int $uid, - string $columnName, + ?int $uid, + private readonly string $columnName, array $assignments ) { + if (is_int($uid) === false) { + throw new InvalidArgumentException('Only integer allowed as uid, need a persisted entity.', 1699352008); + } + $this->uid = $uid; - $this->columnName = $columnName; $this->uids = array_map(static function (AbstractDomainObject $model): int { $uid = $model->getUid(); if (is_int($uid) === false) { diff --git a/Classes/Service/DestinationDataImportService/DatesFactory.php b/Classes/Service/DestinationDataImportService/DatesFactory.php index ea47087..ed504fe 100644 --- a/Classes/Service/DestinationDataImportService/DatesFactory.php +++ b/Classes/Service/DestinationDataImportService/DatesFactory.php @@ -2,6 +2,11 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService; +use DateInterval; +use DatePeriod; +use DateTimeImmutable; +use DateTimeZone; +use Generator; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\Log\LogManager; @@ -10,41 +15,29 @@ class DatesFactory { - /** - * @var Context - */ - private $context; - - /** - * @var ConfigurationManager - */ - private $configurationManager; - /** * @var Logger */ - private $logger; + private readonly \Psr\Log\LoggerInterface $logger; public function __construct( - Context $context, - ConfigurationManager $configurationManager, + private readonly Context $context, + private readonly ConfigurationManager $configurationManager, LogManager $logManager ) { - $this->context = $context; - $this->configurationManager = $configurationManager; - $this->logger = $logManager->getLogger(__CLASS__); + $this->logger = $logManager->getLogger(self::class); } /** - * @return \Generator + * @return Generator */ public function createDates( array $timeIntervals, bool $canceled - ): \Generator { + ): Generator { foreach ($timeIntervals as $date) { $dates = $this->createDate($date, $canceled); - if (!$dates instanceof \Generator) { + if (!$dates instanceof Generator) { return null; } @@ -55,12 +48,12 @@ public function createDates( } /** - * @return \Generator|null + * @return Generator|null */ private function createDate( array $date, bool $canceled - ): ?\Generator { + ): ?Generator { if ($this->isDateSingleDate($date)) { $this->logger->info('Is single date', ['date' => $date]); return $this->createSingleDate($date, $canceled); @@ -99,24 +92,24 @@ private function isDateInterval(array $date): bool } /** - * @return \Generator + * @return Generator */ private function createSingleDate( array $date, bool $canceled - ): \Generator { - if (new \DateTimeImmutable($date['start']) > $this->getToday()) { + ): Generator { + if (new DateTimeImmutable($date['start']) > $this->getToday()) { yield Date::createFromDestinationDataDate($date, $canceled); } } /** - * @return \Generator|null + * @return Generator|null */ private function createDateFromInterval( array $date, bool $canceled - ): ?\Generator { + ): ?Generator { $date = $this->ensureRepeatUntil($date); if ($date['freq'] == 'Daily') { @@ -149,19 +142,19 @@ private function ensureRepeatUntil(array $date): array } /** - * @return \Generator + * @return Generator */ private function createDailyDates( array $date, bool $canceled - ): \Generator { + ): Generator { $today = $this->getToday(); - $timeZone = new \DateTimeZone($date['tz']); - $start = new \DateTimeImmutable($date['start'], $timeZone); - $end = new \DateTimeImmutable($date['end'], $timeZone); - $until = new \DateTimeImmutable($date['repeatUntil'], $timeZone); + $timeZone = new DateTimeZone($date['tz']); + $start = new DateTimeImmutable($date['start'], $timeZone); + $end = new DateTimeImmutable($date['end'], $timeZone); + $until = new DateTimeImmutable($date['repeatUntil'], $timeZone); - $period = new \DatePeriod($start, new \DateInterval('P1D'), $until); + $period = new DatePeriod($start, new DateInterval('P1D'), $until); foreach ($period as $day) { $day = $day->setTimezone($timeZone); if ($day < $today) { @@ -179,23 +172,23 @@ private function createDailyDates( } /** - * @return \Generator + * @return Generator */ private function createWeeklyDates( array $date, bool $canceled - ): \Generator { + ): Generator { $today = $this->getToday(); - $timeZone = new \DateTimeZone($date['tz']); - $start = new \DateTimeImmutable($date['start'], $timeZone); - $end = new \DateTimeImmutable($date['end'], $timeZone); - $until = new \DateTimeImmutable($date['repeatUntil'], $timeZone); + $timeZone = new DateTimeZone($date['tz']); + $start = new DateTimeImmutable($date['start'], $timeZone); + $end = new DateTimeImmutable($date['end'], $timeZone); + $until = new DateTimeImmutable($date['repeatUntil'], $timeZone); foreach ($date['weekdays'] as $day) { $dateToUse = $start->modify($day); $dateToUse = $dateToUse->setTime((int)$start->format('H'), (int)$start->format('i')); - $period = new \DatePeriod($dateToUse, new \DateInterval('P1W'), $until); + $period = new DatePeriod($dateToUse, new DateInterval('P1W'), $until); foreach ($period as $day) { $day = $day->setTimezone($timeZone); if ($day < $today) { @@ -214,9 +207,9 @@ private function createWeeklyDates( } private function createDateFromStartAndEnd( - \DateTimeImmutable $dateToUse, - \DateTimeImmutable $start, - \DateTimeImmutable $end, + DateTimeImmutable $dateToUse, + DateTimeImmutable $start, + DateTimeImmutable $end, bool $canceled ): Date { return Date::createFromDestinationData( @@ -226,11 +219,11 @@ private function createDateFromStartAndEnd( ); } - private function getToday(): \DateTimeImmutable + private function getToday(): DateTimeImmutable { - $today = $this->context->getPropertyFromAspect('date', 'full', new \DateTimeImmutable()); - if (!$today instanceof \DateTimeImmutable) { - $today = new \DateTimeImmutable(); + $today = $this->context->getPropertyFromAspect('date', 'full', new DateTimeImmutable()); + if (!$today instanceof DateTimeImmutable) { + $today = new DateTimeImmutable(); } return $today->modify('midnight'); diff --git a/Classes/Service/DestinationDataImportService/Events/CategoriesAssignEvent.php b/Classes/Service/DestinationDataImportService/Events/CategoriesAssignEvent.php index fcc4a2f..0c4325b 100644 --- a/Classes/Service/DestinationDataImportService/Events/CategoriesAssignEvent.php +++ b/Classes/Service/DestinationDataImportService/Events/CategoriesAssignEvent.php @@ -29,24 +29,18 @@ final class CategoriesAssignEvent { - /** - * @var Event - */ - private $event; - /** * @var ObjectStorage */ - private $categories; + private \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories; /** * @param ObjectStorage $categories */ public function __construct( - Event $event, + private readonly Event $event, ObjectStorage $categories ) { - $this->event = $event; $this->setCategories($categories); } diff --git a/Classes/Service/DestinationDataImportService/Events/EventImportEvent.php b/Classes/Service/DestinationDataImportService/Events/EventImportEvent.php index afb9c45..00bc68f 100644 --- a/Classes/Service/DestinationDataImportService/Events/EventImportEvent.php +++ b/Classes/Service/DestinationDataImportService/Events/EventImportEvent.php @@ -27,22 +27,10 @@ final class EventImportEvent { - /** - * @var Event - */ - private $existingEvent; - - /** - * @var Event - */ - private $eventToImport; - public function __construct( - Event $existingEvent, - Event $eventToImport + private readonly Event $existingEvent, + private readonly Event $eventToImport ) { - $this->existingEvent = $existingEvent; - $this->eventToImport = $eventToImport; } public function getBaseEvent(): Event diff --git a/Classes/Service/DestinationDataImportService/FilesAssignment.php b/Classes/Service/DestinationDataImportService/FilesAssignment.php index 26853fb..6586d81 100644 --- a/Classes/Service/DestinationDataImportService/FilesAssignment.php +++ b/Classes/Service/DestinationDataImportService/FilesAssignment.php @@ -24,7 +24,7 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService; use Exception; -use Psr\Log\LoggerInterface; +use SplFileInfo; use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Resource\DuplicationBehavior; use TYPO3\CMS\Core\Resource\File; @@ -38,36 +38,15 @@ class FilesAssignment { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var DataFetcher - */ - private $dataFetcher; - - /** - * @var ResourceFactory - */ - private $resourceFactory; - - /** - * @var MetaDataRepository - */ - private $metaDataRepository; + private readonly \Psr\Log\LoggerInterface $logger; public function __construct( LogManager $logManager, - DataFetcher $dataFetcher, - ResourceFactory $resourceFactory, - MetaDataRepository $metaDataRepository + private readonly DataFetcher $dataFetcher, + private readonly ResourceFactory $resourceFactory, + private readonly MetaDataRepository $metaDataRepository ) { $this->logger = $logManager->getLogger(self::class); - $this->dataFetcher = $dataFetcher; - $this->resourceFactory = $resourceFactory; - $this->metaDataRepository = $metaDataRepository; } /** @@ -86,7 +65,7 @@ public function getImages( continue; } - $fileUrl = urldecode($mediaObject['url']); + $fileUrl = urldecode((string)$mediaObject['url']); $orgFileNameSanitized = $importFolder->getStorage()->sanitizeFileName(basename($fileUrl)); $this->logger->info('File attached.', [$fileUrl, $orgFileNameSanitized]); @@ -124,7 +103,7 @@ private function loadFile(string $fileUrl): string try { $response = $this->dataFetcher->fetchImage($fileUrl); - } catch (Exception $e) { + } catch (Exception) { $this->logger->error('Cannot load file.', [$fileUrl]); return ''; } @@ -134,7 +113,7 @@ private function loadFile(string $fileUrl): string return ''; } - $file = new \SplFileInfo($fileUrl); + $file = new SplFileInfo($fileUrl); $temporaryFilename = GeneralUtility::tempnam($file->getBasename()); $writeResult = GeneralUtility::writeFile($temporaryFilename, $response->getBody()->__toString(), true); if ($writeResult === false) { diff --git a/Classes/Service/DestinationDataImportService/LocationAssignment.php b/Classes/Service/DestinationDataImportService/LocationAssignment.php index d3d201d..5cba5ec 100644 --- a/Classes/Service/DestinationDataImportService/LocationAssignment.php +++ b/Classes/Service/DestinationDataImportService/LocationAssignment.php @@ -7,15 +7,9 @@ class LocationAssignment { - /** - * @var LocationRepository - */ - private $repository; - public function __construct( - LocationRepository $repository + private readonly LocationRepository $repository ) { - $this->repository = $repository; } public function getLocation(array $event): ?Location diff --git a/Classes/Service/DestinationDataImportService/Slugger.php b/Classes/Service/DestinationDataImportService/Slugger.php index 05bef3f..1ba8be6 100644 --- a/Classes/Service/DestinationDataImportService/Slugger.php +++ b/Classes/Service/DestinationDataImportService/Slugger.php @@ -23,6 +23,8 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService; +use Generator; +use PDO; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\DataHandling\SlugHelper; @@ -32,22 +34,10 @@ class Slugger { - /** - * @var Registry - */ - private $registry; - - /** - * @var ConnectionPool - */ - private $connectionPool; - public function __construct( - Registry $registry, - ConnectionPool $connectionPool + private readonly Registry $registry, + private readonly ConnectionPool $connectionPool ) { - $this->registry = $registry; - $this->connectionPool = $connectionPool; } public function update(string $tableName): void @@ -59,9 +49,9 @@ public function update(string $tableName): void } /** - * @return \Generator + * @return Generator */ - private function getRecords(SluggerType $sluggerType): \Generator + private function getRecords(SluggerType $sluggerType): Generator { $tableName = $sluggerType->getSupportedTableName(); $slugColumn = $sluggerType->getSlugColumn(); @@ -70,12 +60,13 @@ private function getRecords(SluggerType $sluggerType): \Generator $statement = $queryBuilder->select('*') ->from($tableName) ->where( - $queryBuilder->expr()->orX( - $queryBuilder->expr()->eq($slugColumn, $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)), + $queryBuilder->expr()->or( + $queryBuilder->expr()->eq($slugColumn, $queryBuilder->createNamedParameter('', PDO::PARAM_STR)), $queryBuilder->expr()->isNull($slugColumn) ) ) - ->execute(); + ->executeQuery() + ; while ($record = $statement->fetch()) { if (is_array($record) === false) { @@ -97,11 +88,11 @@ private function updateRecord(SluggerType $sluggerType, array $record): void ->where( $queryBuilder->expr()->eq( 'uid', - $queryBuilder->createNamedParameter($record['uid'], \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($record['uid'], PDO::PARAM_INT) ) ) ->set($sluggerType->getSlugColumn(), $slug); - $queryBuilder->execute(); + $queryBuilder->executeStatement(); } private function getSlugHelper( diff --git a/Classes/Service/DestinationDataImportService/Slugger/Date.php b/Classes/Service/DestinationDataImportService/Slugger/Date.php index 2ffd0fa..9ad579c 100644 --- a/Classes/Service/DestinationDataImportService/Slugger/Date.php +++ b/Classes/Service/DestinationDataImportService/Slugger/Date.php @@ -23,24 +23,19 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService\Slugger; +use DateTimeImmutable; use TYPO3\CMS\Core\Database\ConnectionPool; class Date implements SluggerType { - /** - * @var ConnectionPool - */ - private $connectionPool; - public function __construct( - ConnectionPool $connectionPool + private readonly ConnectionPool $connectionPool ) { - $this->connectionPool = $connectionPool; } public function prepareRecordForSlugGeneration(array $record): array { - $start = new \DateTimeImmutable('@' . $record['start']); + $start = new DateTimeImmutable('@' . $record['start']); $record['event-title'] = $this->getEventTitle((int)$record['event']); $record['start'] = $start->format('Y-m-d'); @@ -64,7 +59,7 @@ private function getEventTitle(int $eventUid): string $qb->select('title'); $qb->from('tx_events_domain_model_event'); $qb->where($qb->expr()->eq('uid', $eventUid)); - $title = $qb->execute()->fetchOne(); + $title = $qb->executeQuery()->fetchOne(); if (is_string($title)) { return $title; } diff --git a/Classes/Service/DestinationDataImportService/Slugger/Registry.php b/Classes/Service/DestinationDataImportService/Slugger/Registry.php index 8719315..bda3b50 100644 --- a/Classes/Service/DestinationDataImportService/Slugger/Registry.php +++ b/Classes/Service/DestinationDataImportService/Slugger/Registry.php @@ -23,17 +23,19 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService\Slugger; +use Exception; + class Registry { /** * @var SluggerType[] */ - private $sluggers = []; + private array $sluggers = []; public function get(string $tableName): SluggerType { if (!isset($this->sluggers[$tableName])) { - throw new \Exception( + throw new Exception( sprintf( 'No slugger registered for table "%s", only for tables: "%s".', $tableName, diff --git a/Classes/Service/DestinationDataImportService/UrlFactory.php b/Classes/Service/DestinationDataImportService/UrlFactory.php index 6a2831f..d914481 100644 --- a/Classes/Service/DestinationDataImportService/UrlFactory.php +++ b/Classes/Service/DestinationDataImportService/UrlFactory.php @@ -3,8 +3,7 @@ namespace WerkraumMedia\Events\Service\DestinationDataImportService; use TYPO3\CMS\Core\Http\Uri; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager; use WerkraumMedia\Events\Domain\Model\Import; /** @@ -18,13 +17,12 @@ class UrlFactory private $settings = []; public function __construct( - ConfigurationManager $configurationManager + BackendConfigurationManager $configurationManager ) { $this->settings = $configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'Events', 'Pi1' - )['destinationData'] ?? []; + )['settings']['destinationData'] ?? []; } /** diff --git a/Classes/Testing/TypoScriptInstructionModifier.php b/Classes/Testing/TypoScriptInstructionModifier.php deleted file mode 100644 index ea6c9c8..0000000 --- a/Classes/Testing/TypoScriptInstructionModifier.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -namespace WerkraumMedia\Events\Testing; - -use TYPO3\CMS\Core\SingletonInterface; -use TYPO3\CMS\Core\TypoScript\TemplateService; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Hook\TypoScriptInstructionModifier as Typo3TypoScriptInstructionModifier; -use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\RequestBootstrap; - -/** - * Wrap original code to check whether internal request exists. - * It does not exist during import. - * - * No PR upstream as this is probably an unusual use case. - * But we call frontend, import, frontend so have a mix. - */ -class TypoScriptInstructionModifier implements SingletonInterface -{ - public function apply(array $parameters, TemplateService $service): void - { - $request = RequestBootstrap::getInternalRequest(); - if ($request === null) { - return; - } - - GeneralUtility::callUserFunction( - Typo3TypoScriptInstructionModifier::class . '->apply', - $parameters, - $service - ); - } -} diff --git a/Classes/Updates/MigrateDuplicateLocations.php b/Classes/Updates/MigrateDuplicateLocations.php index 875545b..e7fbf0c 100644 --- a/Classes/Updates/MigrateDuplicateLocations.php +++ b/Classes/Updates/MigrateDuplicateLocations.php @@ -26,20 +26,16 @@ use Generator; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; use WerkraumMedia\Events\Domain\Model\Location; +#[UpgradeWizard(MigrateDuplicateLocations::class)] final class MigrateDuplicateLocations implements UpgradeWizardInterface { - /** - * @var ConnectionPool - */ - private $connectionPool; - public function __construct( - ConnectionPool $connectionPool + private readonly ConnectionPool $connectionPool ) { - $this->connectionPool = $connectionPool; } public function getIdentifier(): string @@ -98,11 +94,6 @@ public function getPrerequisites(): array return []; } - public static function register(): void - { - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][self::class] = self::class; - } - /** * @return Generator */ @@ -125,7 +116,7 @@ private function getLocations(): Generator ); $queryBuilder->from('tx_events_domain_model_location'); $queryBuilder->orderBy('uid', 'asc'); - $result = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); foreach ($result->fetchAllAssociative() as $location) { yield $location; @@ -143,7 +134,7 @@ private function getMatchingLocation( $queryBuilder->andWhere($queryBuilder->expr()->neq('uid', $queryBuilder->createNamedParameter($uid))); $queryBuilder->setMaxResults(1); - $uid = $queryBuilder->execute()->fetchOne(); + $uid = $queryBuilder->executeQuery()->fetchOne(); if (is_numeric($uid) === false) { return 0; } @@ -175,7 +166,7 @@ private function updateLocation(Location $location, int $uid): void $queryBuilder->set('global_id', $location->getGlobalId()); $queryBuilder->set('latitude', $location->getLatitude()); $queryBuilder->set('longitude', $location->getLongitude()); - $queryBuilder->execute(); + $queryBuilder->executeStatement(); } /** @@ -186,7 +177,7 @@ private function removeDuplicates(array $uids): void $queryBuilder = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_location'); $queryBuilder->delete('tx_events_domain_model_location'); $queryBuilder->where($queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter($uids, Connection::PARAM_INT_ARRAY))); - $queryBuilder->execute(); + $queryBuilder->executeStatement(); } private function updateRelations(array $migration): void @@ -198,7 +189,7 @@ private function updateRelations(array $migration): void $finalBuilder = clone $queryBuilder; $finalBuilder->where($finalBuilder->expr()->eq('location', $finalBuilder->createNamedParameter($legacyLocationUid))); $finalBuilder->set('location', $newLocationUid); - $finalBuilder->execute(); + $finalBuilder->executeStatement(); } } } diff --git a/Classes/Updates/MigrateOldLocations.php b/Classes/Updates/MigrateOldLocations.php index ad28e0e..a6fcdbe 100644 --- a/Classes/Updates/MigrateOldLocations.php +++ b/Classes/Updates/MigrateOldLocations.php @@ -23,43 +23,31 @@ namespace WerkraumMedia\Events\Updates; +use Exception; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Log\Logger; use TYPO3\CMS\Core\Log\LogManager; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; +#[UpgradeWizard(MigrateOldLocations::class)] class MigrateOldLocations implements UpgradeWizardInterface { - /** - * @var ConnectionPool - */ - private $connectionPool; - - /** - * @var DataHandler - */ - private $dataHandler; - /** * @var Logger */ - private $logger; + private readonly \Psr\Log\LoggerInterface $logger; - /** - * @var array - */ - private $uidsForTranslation = []; + private array $uidsForTranslation = []; public function __construct( - ConnectionPool $connectionPool, - DataHandler $dataHandler, + private readonly ConnectionPool $connectionPool, + private readonly DataHandler $dataHandler, LogManager $logManager ) { - $this->connectionPool = $connectionPool; - $this->dataHandler = $dataHandler; $this->logger = $logManager->getLogger(self::class); } @@ -76,16 +64,14 @@ public function getDescription(): string public function updateNecessary(): bool { return $this->hasOldColumns() - && $this->getQueryBuilder() - ->count('*') - ->execute() + && $this->getQueryBuilder()->count('*')->executeQuery() ->fetchOne() > 0 ; } public function executeUpdate(): bool { - $result = $this->getQueryBuilder()->execute(); + $result = $this->getQueryBuilder()->executeQuery()->iterateAssociative(); foreach ($result as $eventRecord) { $this->logger->info('Updating event record.', ['record' => $eventRecord]); $eventRecord['location'] = $this->getLocationUid($eventRecord); @@ -127,7 +113,7 @@ private function getExitingLocationUid(array $event): int $qb->andWhere($qb->expr()->eq($column, $qb->createNamedParameter($event[$column]))); } - $uids = $qb->execute()->fetchAssociative(); + $uids = $qb->executeQuery()->fetchAssociative(); if (is_bool($uids)) { return 0; } @@ -203,7 +189,7 @@ private function createLocation(array $event): int return $l10nParentUid; } - throw new \Exception('Could not create location: ' . implode(', ', $dataHandler->errorLog), 1672916613); + throw new Exception('Could not create location: ' . implode(', ', $dataHandler->errorLog), 1672916613); } private function updateEvent(array $event): void @@ -283,9 +269,4 @@ private function columnsToFetch(): array 'longitude', ]; } - - public static function register(): void - { - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][self::class] = self::class; - } } diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php index 6b1a511..26d228b 100644 --- a/Configuration/Extbase/Persistence/Classes.php +++ b/Configuration/Extbase/Persistence/Classes.php @@ -2,8 +2,10 @@ declare(strict_types=1); +use WerkraumMedia\Events\Domain\Model\Category; + return [ - \WerkraumMedia\Events\Domain\Model\Category::class => [ + Category::class => [ 'tableName' => 'sys_category', ], ]; diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index b3020fb..a5090de 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -48,3 +48,6 @@ services: - name: event.listener event: WerkraumMedia\Events\Events\Controller\DateListVariables method: 'trackDates' + - name: event.listener + event: TYPO3\CMS\Frontend\Event\ModifyCacheLifetimeForPageEvent + method: 'modifyCacheLifetimeForPage' diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 280da37..aa14dd2 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -1,11 +1,14 @@ [ 'typeicon_classes' => [ 'contains-events' => 'pages-module-events', @@ -13,13 +16,13 @@ ], ]); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( + ExtensionManagementUtility::addTcaSelectItem( $tableName, 'module', [ - 0 => $languagePath . '.module.events', - 1 => 'events', - 2 => 'pages-module-events', + 'label' => $languagePath . '.module.events', + 'value' => 'events', + 'icon' => 'pages-module-events', ] ); })('events', 'pages'); diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php index 9a3949a..f6dfe13 100644 --- a/Configuration/TCA/Overrides/sys_category.php +++ b/Configuration/TCA/Overrides/sys_category.php @@ -1,7 +1,9 @@ [ 'sorting' => [ 'config' => [ diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php index d42767b..0a6d9b3 100644 --- a/Configuration/TCA/Overrides/sys_template.php +++ b/Configuration/TCA/Overrides/sys_template.php @@ -1,9 +1,11 @@ 'Categories', - 'fieldConfiguration' => [ - 'minitems' => 0, - 'multiple' => true, - ], - ] - ); - - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( - $extKey, - $table, - 'features', - [ - 'label' => 'Features', - 'fieldConfiguration' => [ - 'minitems' => 0, - 'multiple' => true, - ], - ] - ); -})('events', 'tx_events_domain_model_event'); diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 6f1b6b7..5387c6a 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -8,7 +8,6 @@ 'label_alt_force' => true, 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -29,19 +28,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -51,7 +38,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_date', 'foreign_table_where' => 'AND {#tx_events_domain_model_date}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_date}.{#sys_language_uid} IN (-1,0)', @@ -78,7 +65,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -89,10 +76,7 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -102,13 +86,7 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038), - ], + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -119,11 +97,8 @@ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.start', 'config' => [ - //'dbType' => 'datetime', - 'type' => 'input', - 'renderType' => 'inputDateTime', + 'type' => 'datetime', 'size' => 12, - 'eval' => 'datetime', 'default' => null, ], ], @@ -131,11 +106,8 @@ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.end', 'config' => [ - //'dbType' => 'datetime', - 'type' => 'input', - 'renderType' => 'inputDateTime', + 'type' => 'datetime', 'size' => 12, - 'eval' => 'datetime', 'default' => null, ], ], @@ -148,16 +120,16 @@ 'default' => 'no', 'items' => [ '0' => [ - '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.no', - '1' => 'no', + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.no', + 'value' => 'no', ], '1' => [ - '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.canceled', - '1' => 'canceled', + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.canceled', + 'value' => 'canceled', ], '2' => [ - '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.postponed', - '1' => 'postponed', + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.postponed', + 'value' => 'postponed', ], ], ], @@ -174,8 +146,8 @@ 'default' => '0', 'items' => [ '0' => [ - '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date.0', - '1' => '0', + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date.0', + 'value' => '0', ], ], ], @@ -185,18 +157,7 @@ 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled_link', 'displayCond' => 'FIELD:canceled:=:canceled', 'config' => [ - 'type' => 'input', - 'softref' => 'typolink', - 'renderType' => 'inputLink', - 'max' => 1024, - 'eval' => 'trim', - 'fieldControl' => [ - 'linkPopup' => [ - 'options' => [ - 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel', - ], - ], - ], + 'type' => 'link', ], ], 'slug' => [ diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 39c185e..3ef6779 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -1,7 +1,9 @@ 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -78,19 +79,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - $l10nPathGeneral . ':LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -100,7 +89,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_event', 'foreign_table_where' => 'AND {#tx_events_domain_model_event}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_event}.{#sys_language_uid} IN (-1,0)', @@ -127,7 +116,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -138,10 +127,7 @@ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -151,13 +137,7 @@ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038), - ], + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -205,9 +185,7 @@ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.source_url', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputLink', - 'softref' => 'typolink', + 'type' => 'link', 'readOnly' => true, ], ], @@ -235,7 +213,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => false, ], @@ -293,12 +271,8 @@ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.ticket', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputLink', - 'eval' => 'trim', - 'max' => 1024, + 'type' => 'link', 'size' => 50, - 'softref' => 'typolink', ], ], 'facebook' => [ @@ -331,57 +305,45 @@ 'images' => [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.images', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'images', - [ - 'appearance' => [ - 'createNewRelationLinkTitle' => $l10nPathFE . ':images.addFileReference', - 'showPossibleLocalizationRecords' => true, - 'showRemovedLocalizationRecords' => true, - 'showAllLocalizationLink' => true, - 'showSynchronizationLink' => true, - ], - 'foreign_match_fields' => [ - 'fieldname' => 'images', - 'tablenames' => 'tx_events_domain_model_event', - 'table_local' => 'sys_file', - ], - 'foreign_types' => [ + 'config' => [ + 'type' => 'file', + 'maxitems' => 8, + 'allowed' => 'common-image-types', + 'overrideChildTca' => [ + 'types' => [ '0' => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ + File::FILETYPE_TEXT => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + File::FILETYPE_IMAGE => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ + File::FILETYPE_AUDIO => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ + File::FILETYPE_VIDEO => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ + File::FILETYPE_APPLICATION => [ 'showitem' => ' - --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, - --palette--;;filePalette', + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;;filePalette', ], ], - 'maxitems' => 8, ], - $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] - ), + ], ], 'pages' => [ @@ -389,16 +351,27 @@ 'label' => $l10nPath . ':tx_events_domain_model_event.pages', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'pages', ], ], 'categories' => [ 'exclude' => true, + 'label' => 'Categories', + 'config' => [ + 'type' => 'category', + 'minitems' => 0, + 'multiple' => true, + ], ], 'features' => [ 'exclude' => true, + 'label' => 'Features', + 'config' => [ + 'type' => 'category', + 'minitems' => 0, + 'multiple' => true, + ], ], 'dates' => [ @@ -424,7 +397,6 @@ ], 'levelLinksPosition' => 'top', 'showPossibleLocalizationRecords' => false, - 'showRemovedLocalizationRecords' => false, 'showSynchronizationLink' => false, 'showAllLocalizationLink' => false, ], @@ -475,7 +447,6 @@ 'label' => $l10nPath . ':tx_events_domain_model_event.references_events', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'tx_events_domain_model_event', 'suggestOptions' => [ 'tx_events_domain_model_event' => [ @@ -490,7 +461,6 @@ 'label' => $l10nPath . ':tx_events_domain_model_event.partner', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'tx_events_domain_model_partner', 'fieldControl' => [ 'addRecord' => [ diff --git a/Configuration/TCA/tx_events_domain_model_import.php b/Configuration/TCA/tx_events_domain_model_import.php index 7a391e9..161c335 100644 --- a/Configuration/TCA/tx_events_domain_model_import.php +++ b/Configuration/TCA/tx_events_domain_model_import.php @@ -8,7 +8,6 @@ 'label_alt_force' => true, 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', @@ -48,7 +47,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -72,7 +71,6 @@ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.storage_pid.description', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'maxitems' => 1, @@ -84,7 +82,6 @@ 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.region', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'tx_events_domain_model_region', 'size' => 1, 'maxitems' => 1, @@ -97,7 +94,6 @@ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.categories_pid.description', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'maxitems' => 1, @@ -110,7 +106,6 @@ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.category_parent.description', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'sys_category', 'size' => 1, 'maxitems' => 1, @@ -123,7 +118,6 @@ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.features_pid.description', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'maxitems' => 1, @@ -136,7 +130,6 @@ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.features_parent.description', 'config' => [ 'type' => 'group', - 'internal_type' => 'db', 'allowed' => 'sys_category', 'size' => 1, 'maxitems' => 1, @@ -148,8 +141,7 @@ 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.files_folder', 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.files_folder.description', 'config' => [ - 'type' => 'group', - 'internal_type' => 'folder', + 'type' => 'folder', 'size' => 1, 'maxitems' => 1, 'minitems' => 1, diff --git a/Configuration/TCA/tx_events_domain_model_location.php b/Configuration/TCA/tx_events_domain_model_location.php index f020bfb..470de90 100644 --- a/Configuration/TCA/tx_events_domain_model_location.php +++ b/Configuration/TCA/tx_events_domain_model_location.php @@ -9,7 +9,6 @@ 'label' => 'name', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -50,19 +49,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - $l10nPathGeneral . ':LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -72,7 +59,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_location', 'foreign_table_where' => 'AND {#tx_events_domain_model_location}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_location}.{#sys_language_uid} IN (-1,0)', @@ -99,7 +86,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -110,10 +97,7 @@ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -123,13 +107,7 @@ 'exclude' => true, 'label' => $l10nPathGeneral . ':LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038), - ], + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], diff --git a/Configuration/TCA/tx_events_domain_model_organizer.php b/Configuration/TCA/tx_events_domain_model_organizer.php index c776f7e..67a64ca 100644 --- a/Configuration/TCA/tx_events_domain_model_organizer.php +++ b/Configuration/TCA/tx_events_domain_model_organizer.php @@ -6,7 +6,6 @@ 'label' => 'name', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -27,19 +26,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -49,7 +36,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_organizer', 'foreign_table_where' => 'AND {#tx_events_domain_model_organizer}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_organizer}.{#sys_language_uid} IN (-1,0)', @@ -76,7 +63,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -87,10 +74,8 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, + 'type' => 'datetime', + 'format' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -100,13 +85,7 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038), - ], + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], diff --git a/Configuration/TCA/tx_events_domain_model_partner.php b/Configuration/TCA/tx_events_domain_model_partner.php index 580a02d..a8dd090 100644 --- a/Configuration/TCA/tx_events_domain_model_partner.php +++ b/Configuration/TCA/tx_events_domain_model_partner.php @@ -1,12 +1,13 @@ [ 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -25,19 +26,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -47,7 +36,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_partner', 'foreign_table_where' => 'AND {#tx_events_domain_model_partner}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_partner}.{#sys_language_uid} IN (-1,0)', @@ -74,7 +63,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -95,21 +84,15 @@ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.link', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputLink', - 'eval' => 'trim', - 'max' => 1024, - 'size' => 50, - 'softref' => 'typolink', + 'type' => 'link', ], ], 'images' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.images', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('images', [ - 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference', - ], + 'config' => [ + 'type' => 'file', + 'allowed' => 'common-image-types', // custom configuration for displaying fields in the overlay/reference table // to use the imageoverlayPalette instead of the basicoverlayPalette 'overrideChildTca' => [ @@ -119,14 +102,14 @@ --palette--;;imageoverlayPalette, --palette--;;filePalette', ], - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + File::FILETYPE_IMAGE => [ 'showitem' => ' --palette--;;imageoverlayPalette, --palette--;;filePalette', ], ], ], - ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), + ], ], ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_region.php b/Configuration/TCA/tx_events_domain_model_region.php index 3cc74c6..117d844 100644 --- a/Configuration/TCA/tx_events_domain_model_region.php +++ b/Configuration/TCA/tx_events_domain_model_region.php @@ -6,7 +6,6 @@ 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'versioningWS' => true, 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', @@ -27,19 +26,7 @@ 'sys_language_uid' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple', - ], - ], - 'default' => 0, - ], + 'config' => ['type' => 'language'], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -49,7 +36,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + ['label' => '', 'value' => 0], ], 'foreign_table' => 'tx_events_domain_model_region', 'foreign_table_where' => 'AND {#tx_events_domain_model_region}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_region}.{#sys_language_uid} IN (-1,0)', @@ -76,7 +63,7 @@ 'renderType' => 'checkboxToggle', 'items' => [ [ - 0 => '', + 'label' => '', 1 => '', 'invertStateDisplay' => true, ], @@ -87,10 +74,7 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], @@ -100,13 +84,7 @@ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038), - ], + 'type' => 'datetime', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 3b97691..718f6d0 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -24,10 +24,6 @@ plugin.tx_events { recursive = 1 } - features { - skipDefaultArguments = 1 - } - mvc { callDefaultActionIfActionCantBeResolved = 1 } diff --git a/Documentation/Changelog/4.0.0.rst b/Documentation/Changelog/4.0.0.rst index 72581a2..3014e3a 100644 --- a/Documentation/Changelog/4.0.0.rst +++ b/Documentation/Changelog/4.0.0.rst @@ -4,6 +4,11 @@ Breaking -------- +* Drop support of TYPO3 and PHP versions. + We drop support for any TYPO3 version below 12. + We drop support for PHP versions not supported by TYPO3 v12. + That eases the maintenance of the extension. + * Change of vendor/namespace. The vendor was renamed from `wrm` to `werkraummedia`. And the namespace vendor was renamed from `Wrm` to `WerkraumMedia`. @@ -11,10 +16,15 @@ Breaking That way all references to PHP classes as well as the package name itself need to be adjusted. +* No longer allow records on standard pages. + Please use TCA Overrides in case you need this none default TYPO3 behaviour. + Features -------- -Nothing +* Support TYPO3 v12. + +* Support PHP 8.1, 8.2, 8.3. Fixes ----- diff --git a/Documentation/Index.rst b/Documentation/Index.rst index d340916..1b1626a 100644 --- a/Documentation/Index.rst +++ b/Documentation/Index.rst @@ -42,7 +42,6 @@ Table of Contents Commands Settings Changelog - Maintenance .. toctree:: :hidden: diff --git a/Documentation/Maintenance.rst b/Documentation/Maintenance.rst deleted file mode 100644 index 0bc7487..0000000 --- a/Documentation/Maintenance.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. _maintenance: - -Maintenance -=========== - -List of changes that need to be done for maintenance reasons. - -E.g. changes once we drop a certain TYPO3 version. -We might have new code backported for compatibility in older TYPO3 versions. -Those changes are documented so we know what to do once we drop an older version. - -.. toctree:: - :glob: - :reversed: - - Maintenance/TYPO3/* diff --git a/Documentation/Maintenance/TYPO3/V10.rst b/Documentation/Maintenance/TYPO3/V10.rst deleted file mode 100644 index 6d096a9..0000000 --- a/Documentation/Maintenance/TYPO3/V10.rst +++ /dev/null @@ -1,17 +0,0 @@ -TYPO3 V10 -========= - -Changes that should happen once we drop TYPO3 v10. - - -Remove fetching cached page stage from body from tests ------------------------------------------------------- - -We have different assertions based on TYPO3 version, due to how TYPO3 exposes the info. -We can remove the condition with its content once we drop v10. - -Remove condition for page not found handling --------------------------------------------- - -The :php:`AbstractController->trigger404()` method has a condition to handle 404 differently for TYPO3 v10. -The condition can be removed. diff --git a/Documentation/Maintenance/TYPO3/V11.rst b/Documentation/Maintenance/TYPO3/V11.rst deleted file mode 100644 index cd2ca9d..0000000 --- a/Documentation/Maintenance/TYPO3/V11.rst +++ /dev/null @@ -1,12 +0,0 @@ -TYPO3 V11 -========= - -Changes that should happen once we drop TYPO3 v11. - -Remove ``SlidingWindowPagination`` backport. --------------------------------------------- - -We backported https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Feature-94625-IntroduceSlidingWindowPagination.html. -That allowed us to use the new Code compatible with v12 onwards. - -We should remove the file ``Classes/Backports/V12/Pagination/SlidingWindowPagination.php`` and switch to TYPO3 native class within ``WerkraumMedia\Events\Pagination\Factory``. diff --git a/Patches/testing-framework-request-state.patch b/Patches/testing-framework-request-state.patch new file mode 100644 index 0000000..32efdd8 --- /dev/null +++ b/Patches/testing-framework-request-state.patch @@ -0,0 +1,28 @@ +diff --git a/Classes/Core/Functional/Framework/FrameworkState.php b/Classes/Core/Functional/Framework/FrameworkState.php +index 93716fc..f900539 100644 +--- a/Classes/Core/Functional/Framework/FrameworkState.php ++++ b/Classes/Core/Functional/Framework/FrameworkState.php +@@ -50,6 +50,7 @@ class FrameworkState + // different. And code that runs after that within the test scope may fail (eg. the referenceIndex check in tearDown() that + // relies on TCA). So we back up TCA for now before executing frontend tests. + $state['globals-tca'] = $GLOBALS['TCA']; ++ $state['request'] = $GLOBALS['TYPO3_REQUEST'] ?? null; + + // Can be dropped when GeneralUtility::getIndpEnv() is abandoned + $generalUtilityReflection = new \ReflectionClass(GeneralUtility::class); +@@ -67,6 +68,7 @@ class FrameworkState + public static function reset() + { + unset($GLOBALS['BE_USER']); ++ unset($GLOBALS['TYPO3_REQUEST']); + + $generalUtilityReflection = new \ReflectionClass(GeneralUtility::class); + $generalUtilityIndpEnvCache = $generalUtilityReflection->getProperty('indpEnvCache'); +@@ -91,6 +93,7 @@ class FrameworkState + } + + $GLOBALS['TCA'] = $state['globals-tca']; ++ $GLOBALS['TYPO3_REQUEST'] = $state['request']; + + $generalUtilityReflection = new \ReflectionClass(GeneralUtility::class); + $generalUtilityIndpEnvCache = $generalUtilityReflection->getProperty('indpEnvCache'); diff --git a/Patches/testing-framework-ts-record.patch b/Patches/testing-framework-ts-record.patch new file mode 100644 index 0000000..a94e3e7 --- /dev/null +++ b/Patches/testing-framework-ts-record.patch @@ -0,0 +1,18 @@ +Use "same" value for tstamp and crdate. +Otherwise TYPO3 will have different cache identifier if multiple requests with same instruction are given. +diff --git a/Resources/Core/Functional/Extensions/json_response/Classes/EventListener/AddTypoScriptFromInternalRequest.php b/Resources/Core/Functional/Extensions/json_response/Classes/EventListener/AddTypoScriptFromInternalRequest.php +index 111a997..504a899 100644 +--- a/Resources/Core/Functional/Extensions/json_response/Classes/EventListener/AddTypoScriptFromInternalRequest.php ++++ b/Resources/Core/Functional/Extensions/json_response/Classes/EventListener/AddTypoScriptFromInternalRequest.php +@@ -49,8 +49,8 @@ final class AddTypoScriptFromInternalRequest + $newTemplateRow = [ + 'uid' => PHP_INT_MAX, + 'pid' => PHP_INT_MAX, +- 'tstamp' => time(), +- 'crdate' => time(), ++ 'tstamp' => (new \DateTimeImmutable('midnight'))->format('U'), ++ 'crdate' => (new \DateTimeImmutable('midnight'))->format('U'), + 'deleted' => 0, + 'starttime' => 0, + 'endtime' => 0, + diff --git a/Tests/Functional/AbstractFunctionalTestCase.php b/Tests/Functional/AbstractFunctionalTestCase.php index 4954d29..41b2683 100644 --- a/Tests/Functional/AbstractFunctionalTestCase.php +++ b/Tests/Functional/AbstractFunctionalTestCase.php @@ -30,16 +30,16 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\DependencyInjection\Container; +use TypeError; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Localization\LanguageServiceFactory; -use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; +use UnexpectedValueException; use WerkraumMedia\Events\Command\ImportDestinationDataViaConfigruationCommand; -use WerkraumMedia\Events\Testing\TypoScriptInstructionModifier; use WerkraumMedia\Events\Tests\ClientFactory; abstract class AbstractFunctionalTestCase extends FunctionalTestCase @@ -55,18 +55,21 @@ abstract class AbstractFunctionalTestCase extends FunctionalTestCase protected function setUp(): void { - $this->coreExtensionsToLoad = array_merge($this->coreExtensionsToLoad, [ + $this->coreExtensionsToLoad = [ + ...$this->coreExtensionsToLoad, 'filelist', 'fluid_styled_content', - ]); + ]; - $this->testExtensionsToLoad = array_merge($this->testExtensionsToLoad, [ + $this->testExtensionsToLoad = [ + ...$this->testExtensionsToLoad, 'typo3conf/ext/events', - ]); + ]; - $this->pathsToProvideInTestInstance = array_merge($this->pathsToProvideInTestInstance, [ + $this->pathsToLinkInTestInstance = [ + ...$this->pathsToLinkInTestInstance, 'typo3conf/ext/events/Tests/Functional/Frontend/Fixtures/Sites/' => 'typo3conf/sites', - ]); + ]; ArrayUtility::mergeRecursiveWithOverrule($this->configurationToUseInTestInstance, [ 'FE' => [ @@ -80,22 +83,16 @@ protected function setUp(): void 'processor_path_lzw' => '/usr/bin/', 'processor' => 'ImageMagick', ], - 'SC_OPTIONS' => [ - 'Core/TypoScript/TemplateService' => [ - 'runThroughTemplatesPostProcessing' => [ - 'FunctionalTest' => TypoScriptInstructionModifier::class . '->apply', - ], - ], - ], ]); parent::setUp(); - $this->setUpBackendUserFromFixture(1); + $this->importPHPDataSet(__DIR__ . '/Fixtures/BeUsers.php'); + $this->setUpBackendUser(1); $languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class); if (!$languageServiceFactory instanceof LanguageServiceFactory) { - throw new \UnexpectedValueException('Did not retrieve LanguageServiceFactory.', 1637847250); + throw new UnexpectedValueException('Did not retrieve LanguageServiceFactory.', 1637847250); } $GLOBALS['LANG'] = $languageServiceFactory->create('default'); @@ -114,7 +111,7 @@ protected function tearDown(): void protected function getTypoScriptInstruction(): TypoScriptInstruction { - return new TypoScriptInstruction(TemplateService::class); + return new TypoScriptInstruction(); } protected function setUpConfiguration( @@ -152,7 +149,7 @@ protected function executeCommand( array $argumentsAndOptions = ['configurationUid' => '1'], string $command = ImportDestinationDataViaConfigruationCommand::class ): CommandTester { - $subject = $this->getContainer()->get($command); + $subject = $this->get($command); self::assertInstanceOf(Command::class, $subject); $tester = new CommandTester($subject); @@ -192,7 +189,7 @@ protected function setDateAspect(DateTimeImmutable $dateTime): void { $context = $this->getContainer()->get(Context::class); if (!$context instanceof Context) { - throw new \TypeError('Retrieved context was of unexpected type.', 1638182021); + throw new TypeError('Retrieved context was of unexpected type.', 1638182021); } $aspect = new DateTimeAspect($dateTime); diff --git a/Tests/Functional/Cleanup/Fixtures/RemoveAllTestDatabase.php b/Tests/Functional/Cleanup/Fixtures/RemoveAllTestDatabase.php index d5a6dbd..41b7421 100644 --- a/Tests/Functional/Cleanup/Fixtures/RemoveAllTestDatabase.php +++ b/Tests/Functional/Cleanup/Fixtures/RemoveAllTestDatabase.php @@ -45,7 +45,6 @@ 'pid' => '0', 'tstamp' => '1423209858', 'crdate' => '1370878372', - 'cruser_id' => '0', 'deleted' => '0', 'name' => 'fileadmin/ (auto-created)', 'description' => 'This is the local fileadmin/ directory. This storage mount has been created automatically by TYPO3.', @@ -126,7 +125,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '1', ], [ @@ -134,7 +132,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '2', ], ], @@ -144,7 +141,6 @@ 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -153,14 +149,12 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '2', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -169,7 +163,6 @@ 'tablenames' => 'tx_events_domain_model_partner', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], ], 'tx_events_domain_model_region' => [ diff --git a/Tests/Functional/Cleanup/Fixtures/RemovePastTestDatabase.php b/Tests/Functional/Cleanup/Fixtures/RemovePastTestDatabase.php index 13ce248..01773a6 100644 --- a/Tests/Functional/Cleanup/Fixtures/RemovePastTestDatabase.php +++ b/Tests/Functional/Cleanup/Fixtures/RemovePastTestDatabase.php @@ -51,7 +51,6 @@ 'pid' => '0', 'tstamp' => '1423209858', 'crdate' => '1370878372', - 'cruser_id' => '0', 'deleted' => '0', 'name' => 'fileadmin/ (auto-created)', 'description' => 'This is the local fileadmin/ directory. This storage mount has been created automatically by TYPO3.', @@ -212,7 +211,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '1', ], [ @@ -220,7 +218,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '2', ], [ @@ -228,7 +225,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '3', ], [ @@ -236,7 +232,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '4', ], [ @@ -244,7 +239,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '5', ], [ @@ -252,7 +246,6 @@ 'pid' => '0', 'tstamp' => '1371467047', 'crdate' => '1371467047', - 'cruser_id' => '1', 'file' => '6', ], ], @@ -262,7 +255,6 @@ 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -271,14 +263,12 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '2', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -287,14 +277,12 @@ 'tablenames' => 'tx_events_domain_model_partner', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '3', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -303,14 +291,12 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '4', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '1', 'hidden' => '0', 'sys_language_uid' => '0', @@ -319,14 +305,12 @@ 'tablenames' => 'tt_content', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '5', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -335,14 +319,12 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => '1', - 'table_local' => 'sys_file', ], [ 'uid' => '6', 'pid' => '2', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -351,14 +333,12 @@ 'tablenames' => '', 'fieldname' => '', 'sorting_foreign' => '0', - 'table_local' => 'sys_file', ], [ 'uid' => '7', 'pid' => '0', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -367,14 +347,12 @@ 'tablenames' => 'pages', 'fieldname' => 'media', 'sorting_foreign' => '0', - 'table_local' => 'sys_file', ], [ 'uid' => '8', 'pid' => '0', 'tstamp' => '1373537480', 'crdate' => '1371484347', - 'cruser_id' => '1', 'deleted' => '0', 'hidden' => '0', 'sys_language_uid' => '0', @@ -383,7 +361,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => '2', - 'table_local' => 'sys_file', ], ], 'tx_events_domain_model_region' => [ diff --git a/Tests/Functional/Cleanup/RemoveAllTest.php b/Tests/Functional/Cleanup/RemoveAllTest.php index a01650a..5b25d92 100644 --- a/Tests/Functional/Cleanup/RemoveAllTest.php +++ b/Tests/Functional/Cleanup/RemoveAllTest.php @@ -2,15 +2,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Cleanup; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; use TYPO3\CMS\Core\Utility\GeneralUtility; use WerkraumMedia\Events\Command\RemoveAllCommand; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -/** - * @testdox Cleanup RemoveAll - */ +#[TestDox('Cleanup RemoveAll')] class RemoveAllTest extends AbstractFunctionalTestCase { protected function setUp(): void @@ -22,9 +22,7 @@ protected function setUp(): void parent::setUp(); } - /** - * @test - */ + #[Test] public function removesAllData(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/RemoveAllTestDatabase.php'); diff --git a/Tests/Functional/Cleanup/RemovePastTest.php b/Tests/Functional/Cleanup/RemovePastTest.php index e6f8613..7f25d5a 100644 --- a/Tests/Functional/Cleanup/RemovePastTest.php +++ b/Tests/Functional/Cleanup/RemovePastTest.php @@ -2,15 +2,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Cleanup; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; use TYPO3\CMS\Core\Utility\GeneralUtility; use WerkraumMedia\Events\Command\RemovePastCommand; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -/** - * @testdox Cleanup RemovePast - */ +#[TestDox('Cleanup RemovePast')] class RemovePastTest extends AbstractFunctionalTestCase { protected function setUp(): void @@ -22,9 +22,7 @@ protected function setUp(): void parent::setUp(); } - /** - * @test - */ + #[Test] public function removesPastData(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/RemovePastTestDatabase.php'); diff --git a/Tests/Functional/Fixtures/BeUsers.php b/Tests/Functional/Fixtures/BeUsers.php new file mode 100644 index 0000000..ee58924 --- /dev/null +++ b/Tests/Functional/Fixtures/BeUsers.php @@ -0,0 +1,17 @@ + [ + [ + 'uid' => 1, + 'pid' => 0, + 'tstamp' => 1366642540, + 'username' => 'admin', + 'password' => '$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1', // password + 'admin' => 1, + 'disable' => 0, + 'crdate' => 1366642540, + 'deleted' => 0, + ], + ], +]; diff --git a/Tests/Functional/Frontend/CacheTest.php b/Tests/Functional/Frontend/CacheTest.php index 61e1804..04f6824 100644 --- a/Tests/Functional/Frontend/CacheTest.php +++ b/Tests/Functional/Frontend/CacheTest.php @@ -27,14 +27,17 @@ use DateTimeImmutable; use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend; +use TYPO3\CMS\Core\Cache\CacheManager; use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use WerkraumMedia\Events\Caching\PageCacheTimeout; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -/** - * @covers \WerkraumMedia\Events\Caching\PageCacheTimeout - */ +#[CoversClass(PageCacheTimeout::class)] class CacheTest extends AbstractFunctionalTestCase { protected function setUp(): void @@ -42,9 +45,28 @@ protected function setUp(): void $this->testExtensionsToLoad = [ 'typo3conf/ext/events/Tests/Functional/Frontend/Fixtures/Extensions/example', ]; + $this->configurationToUseInTestInstance = [ + 'SYS' => [ + // Combined with flushCaches. + // Ensures that we have expected TYPO3 caching within each test. + // But we don't keep caches from one test to the other. + 'caching' => [ + 'cacheConfigurations' => [ + 'pages' => [ + 'backend' => SimpleFileBackend::class, + 'options' => [ + 'compression' => '__UNSET', + ], + ], + ], + ], + ], + ]; parent::setUp(); + $this->get(CacheManager::class)->flushCaches(); + $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SiteStructure.php'); (new PhpDataSet())->import(['tt_content' => [[ 'uid' => '1', @@ -56,21 +78,17 @@ protected function setUp(): void $this->setUpFrontendRendering(); } - /** - * @test - */ + #[Test] public function returnsSystemDefaults(): void { - $response = $this->executeFrontendRequest($this->getRequestWithSleep()); + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep()); self::assertSame(200, $response->getStatusCode()); self::assertSame('max-age=86400', $response->getHeaderLine('Cache-Control')); self::assertSame('public', $response->getHeaderLine('Pragma')); } - /** - * @test - */ + #[Test] public function returnsDefaultsIfEventsEndLater(): void { (new PhpDataSet())->import([ @@ -89,16 +107,14 @@ public function returnsDefaultsIfEventsEndLater(): void ], ]); - $response = $this->executeFrontendRequest($this->getRequestWithSleep()); + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep()); self::assertSame(200, $response->getStatusCode()); self::assertSame('max-age=86400', $response->getHeaderLine('Cache-Control')); self::assertSame('public', $response->getHeaderLine('Pragma')); } - /** - * @test - */ + #[Test] public function returnsEarlierIfEventsEndEarlier(): void { $end = (new DateTimeImmutable('tomorrow midnight', new DateTimeZone('UTC')))->modify('+2 hours'); @@ -121,15 +137,13 @@ public function returnsEarlierIfEventsEndEarlier(): void ], ]); - $response = $this->executeFrontendRequest($this->getRequestWithSleep()); + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep()); self::assertSame(200, $response->getStatusCode()); self::assertCacheHeaders($end, $response); } - /** - * @test - */ + #[Test] public function returnsEarlierIfStartEndEalierAndIsUpcoming(): void { $end = (new DateTimeImmutable('now', new DateTimeZone('UTC')))->modify('+2 hours'); @@ -152,7 +166,7 @@ public function returnsEarlierIfStartEndEalierAndIsUpcoming(): void ], ]); - $response = $this->executeFrontendRequest($this->getRequestWithSleep([ + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep([ 'plugin.' => [ 'tx_events.' => [ 'settings.' => [ @@ -166,9 +180,7 @@ public function returnsEarlierIfStartEndEalierAndIsUpcoming(): void self::assertCacheHeaders($end, $response); } - /** - * @test - */ + #[Test] public function usesEarliestTimeout(): void { $end = (new DateTimeImmutable('now', new DateTimeZone('UTC')))->modify('+2 hours'); @@ -202,7 +214,7 @@ public function usesEarliestTimeout(): void ], ]); - $response = $this->executeFrontendRequest($this->getRequestWithSleep([ + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep([ 'plugin.' => [ 'tx_events.' => [ 'settings.' => [ @@ -216,9 +228,7 @@ public function usesEarliestTimeout(): void self::assertCacheHeaders($end, $response); } - /** - * @test - */ + #[Test] public function returnsMidnightIfConfigured(): void { $midnight = (new DateTimeImmutable('tomorrow midnight', new DateTimeZone('UTC'))); @@ -247,21 +257,19 @@ public function returnsMidnightIfConfigured(): void ], ])); - $response = $this->executeFrontendRequest($this->getRequestWithSleep()); + $response = $this->executeFrontendSubRequest($this->getRequestWithSleep()); self::assertSame(200, $response->getStatusCode()); self::assertCacheHeaders($midnight, $response); self::assertSame('public', $response->getHeaderLine('Pragma')); } - /** - * @test - */ + #[Test] public function cachesAreClearedByImport(): void { // Assert frontend is cached - $this->assertResponseIsNotCached($this->executeFrontendRequest($this->getRequestWithSleep())); - $this->assertResponseIsCached($this->executeFrontendRequest($this->getRequestWithSleep())); + $this->assertResponseIsNotCached($this->executeFrontendSubRequest($this->getRequestWithSleep())); + $this->assertResponseIsCached($this->executeFrontendSubRequest($this->getRequestWithSleep())); // Import $this->importPHPDataSet(__DIR__ . '/../Import/DestinationDataTest/Fixtures/Database/DefaultImportConfiguration.php'); @@ -281,8 +289,8 @@ public function cachesAreClearedByImport(): void // Assert frontend is not cached on first hit $this->setUpFrontendRendering(); - $this->assertResponseIsNotCached($this->executeFrontendRequest($this->getRequestWithSleep())); - $this->assertResponseIsCached($this->executeFrontendRequest($this->getRequestWithSleep())); + $this->assertResponseIsNotCached($this->executeFrontendSubRequest($this->getRequestWithSleep())); + $this->assertResponseIsCached($this->executeFrontendSubRequest($this->getRequestWithSleep())); } private static function assertCacheHeaders(DateTimeImmutable $end, ResponseInterface $response): void @@ -316,10 +324,6 @@ private function assertResponseIsNotCached(ResponseInterface $response): void private function assertResponseIsCached(ResponseInterface $response): void { - if ((new Typo3Version())->getMajorVersion() < 11) { - self::assertStringContainsString('Cached page', $response->getBody()->__toString()); - return; - } self::assertStringStartsWith('Cached page', $response->getHeaderLine('X-TYPO3-Debug-Cache')); } diff --git a/Tests/Functional/Frontend/DatesTest.php b/Tests/Functional/Frontend/DatesTest.php index 7f301d2..6ccd926 100644 --- a/Tests/Functional/Frontend/DatesTest.php +++ b/Tests/Functional/Frontend/DatesTest.php @@ -23,13 +23,13 @@ namespace WerkraumMedia\Events\Tests\Functional\Frontend; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use WerkraumMedia\Events\Frontend\Dates; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -/** - * @covers \WerkraumMedia\Events\Frontend\Dates - */ +#[CoversClass(\WerkraumMedia\Events\Frontend\Dates::class)] class DatesTest extends AbstractFunctionalTestCase { protected function setUp(): void @@ -46,16 +46,15 @@ protected function setUp(): void * Dates don't make any sense without an event, as they not even have a name. * * They therefore should not be fetched from persistence. - * - * @test */ + #[Test] public function returnsOnlyDatesWithAvailableEventByDemand(): void { - $this->importCSVDataSet(__DIR__ . '/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.csv'); + $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.php'); $request = new InternalRequest(); $request = $request->withPageId(1); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); @@ -64,19 +63,17 @@ public function returnsOnlyDatesWithAvailableEventByDemand(): void self::assertStringContainsString('Event 2 visible', $html); } - /** - * @test - */ + #[Test] public function returnsDateAfterStart(): void { - $this->importCSVDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv'); + $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.php'); $request = new InternalRequest(); $request = $request->withPageId(1); $request = $request->withQueryParameters([ 'events_search[search][start]' => '2023-02-16', ]); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); @@ -92,19 +89,17 @@ public function returnsDateAfterStart(): void self::assertStringContainsString('Event 9', $html); } - /** - * @test - */ + #[Test] public function returnsDateBeforeEnd(): void { - $this->importCSVDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv'); + $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.php'); $request = new InternalRequest(); $request = $request->withPageId(1); $request = $request->withQueryParameters([ 'events_search[search][end]' => '2023-02-17', ]); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); @@ -124,12 +119,11 @@ public function returnsDateBeforeEnd(): void * Covers issue https://redmine.werkraum-media.de/issues/10350. * A date can span multiple dates. * The visitor might search a time frame within the spaned dates and expects the date to be shown. - * - * @test */ + #[Test] public function returnsDateWithinTimeSpan(): void { - $this->importCSVDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv'); + $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/ReturnsDateWithinTimeSpan.php'); $request = new InternalRequest(); $request = $request->withPageId(1); @@ -137,7 +131,7 @@ public function returnsDateWithinTimeSpan(): void 'events_search[search][start]' => '2023-02-16', 'events_search[search][end]' => '2023-02-17', ]); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); @@ -153,26 +147,22 @@ public function returnsDateWithinTimeSpan(): void self::assertStringContainsString('Event 9', $html); } - /** - * @test - */ + #[Test] public function returns404IfEventIsHidden(): void { - $this->importCSVDataSet(__DIR__ . '/DatesTestFixtures/Returns404IfEventIsHidden.csv'); + $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/Returns404IfEventIsHidden.php'); $request = new InternalRequest(); $request = $request->withPageId(1); $request = $request->withQueryParameters([ 'tx_events_dateshow[date]' => '1', ]); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(404, $response->getStatusCode()); } - /** - * @test - */ + #[Test] public function returnsUpcomingDates(): void { $this->importPHPDataSet(__DIR__ . '/DatesTestFixtures/ReturnsUpcomingDates.php'); @@ -191,7 +181,7 @@ public function returnsUpcomingDates(): void ], ]), ]); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); diff --git a/Tests/Functional/Frontend/DatesTestFixtures/Returns404IfEventIsHidden.php b/Tests/Functional/Frontend/DatesTestFixtures/Returns404IfEventIsHidden.php new file mode 100644 index 0000000..a60d8e8 --- /dev/null +++ b/Tests/Functional/Frontend/DatesTestFixtures/Returns404IfEventIsHidden.php @@ -0,0 +1,30 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '1', + 'CType' => 'list', + 'list_type' => 'events_dateshow', + 'header' => 'Singleview', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Event 1 starts before search, ends before search', + 'hidden' => '1', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1676419200', + 'end' => '1676484000', + ], + ], +]; diff --git a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv index 0aeabce..ca117d6 100644 --- a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv +++ b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.csv @@ -3,15 +3,15 @@ tt_content ,1,1,list,events_datelist,All Dates tx_events_domain_model_event ,uid,pid,title -,1,2,Event 1 starts before search, ends before search -,2,2,Event 2 starts before search, no end -,3,2,Event 3 starts after search, ends after search -,4,2,Event 4 starts after search, no end -,5,2,Event 5 starts before search, ends after search -,6,2,Event 6 starts inside search, ends inside search -,7,2,Event 7 starts inside search, ends after search -,8,2,Event 8 starts inside search, no end -,9,2,Event 9 starts before search, ends inside search +,1,2,"Event 1 starts before search, ends before search" +,2,2,"Event 2 starts before search, no end" +,3,2,"Event 3 starts after search, ends after search" +,4,2,"Event 4 starts after search, no end" +,5,2,"Event 5 starts before search, ends after search" +,6,2,"Event 6 starts inside search, ends inside search" +,7,2,"Event 7 starts inside search, ends after search" +,8,2,"Event 8 starts inside search, no end" +,9,2,"Event 9 starts before search, ends inside search" tx_events_domain_model_date ,uid,pid,event,start,end ,1,2,1,1676419200,1676484000 diff --git a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.php b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.php new file mode 100644 index 0000000..a2d075e --- /dev/null +++ b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsDateWithinTimeSpan.php @@ -0,0 +1,125 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '1', + 'CType' => 'list', + 'list_type' => 'events_datelist', + 'header' => 'All Dates', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Event 1 starts before search, ends before search', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'title' => 'Event 2 starts before search, no end', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'title' => 'Event 3 starts after search, ends after search', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'title' => 'Event 4 starts after search, no end', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'title' => 'Event 5 starts before search, ends after search', + ], + 5 => [ + 'uid' => '6', + 'pid' => '2', + 'title' => 'Event 6 starts inside search, ends inside search', + ], + 6 => [ + 'uid' => '7', + 'pid' => '2', + 'title' => 'Event 7 starts inside search, ends after search', + ], + 7 => [ + 'uid' => '8', + 'pid' => '2', + 'title' => 'Event 8 starts inside search, no end', + ], + 8 => [ + 'uid' => '9', + 'pid' => '2', + 'title' => 'Event 9 starts before search, ends inside search', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1676419200', + 'end' => '1676484000', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '2', + 'start' => '1676419200', + 'end' => '\\NULL', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'event' => '3', + 'start' => '1676678400', + 'end' => '1676743200', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'event' => '4', + 'start' => '1676678400', + 'end' => '\\NULL', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'event' => '5', + 'start' => '1676419200', + 'end' => '1676678400', + ], + 5 => [ + 'uid' => '6', + 'pid' => '2', + 'event' => '6', + 'start' => '1676559600', + 'end' => '1676570400', + ], + 6 => [ + 'uid' => '7', + 'pid' => '2', + 'event' => '7', + 'start' => '1676559600', + 'end' => '1676678400', + ], + 7 => [ + 'uid' => '8', + 'pid' => '2', + 'event' => '8', + 'start' => '1676559600', + 'end' => '\\NULL', + ], + 8 => [ + 'uid' => '9', + 'pid' => '2', + 'event' => '9', + 'start' => '1676419200', + 'end' => '1676570400', + ], + ], +]; diff --git a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.php b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.php new file mode 100644 index 0000000..ff32628 --- /dev/null +++ b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsOnlyDatesWithAvailableEventByDemand.php @@ -0,0 +1,43 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '1', + 'CType' => 'list', + 'list_type' => 'events_datelist', + 'header' => 'All Dates', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Event 1 hidden', + 'hidden' => '1', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'title' => 'Event 2 visible', + 'hidden' => '0', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1662458400', + 'end' => '1662469200', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '2', + 'start' => '1662458400', + 'end' => '1662469200', + ], + ], +]; diff --git a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsUpcomingDates.php b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsUpcomingDates.php index 2cd7aeb..315d4b4 100644 --- a/Tests/Functional/Frontend/DatesTestFixtures/ReturnsUpcomingDates.php +++ b/Tests/Functional/Frontend/DatesTestFixtures/ReturnsUpcomingDates.php @@ -1,7 +1,5 @@ [ [ diff --git a/Tests/Functional/Frontend/FilterTest.php b/Tests/Functional/Frontend/FilterTest.php index edc8291..8e522ba 100644 --- a/Tests/Functional/Frontend/FilterTest.php +++ b/Tests/Functional/Frontend/FilterTest.php @@ -4,13 +4,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Frontend; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use WerkraumMedia\Events\Controller\DateController; +use WerkraumMedia\Events\Domain\Repository\DateRepository; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -/** - * @covers \WerkraumMedia\Events\Controller\DateController - * @covers \WerkraumMedia\Events\Domain\Repository\DateRepository - */ +#[CoversClass(DateController::class)] +#[CoversClass(DateRepository::class)] class FilterTest extends AbstractFunctionalTestCase { protected function setUp(): void @@ -21,16 +23,14 @@ protected function setUp(): void $this->setUpFrontendRendering(); } - /** - * @test - */ + #[Test] public function canFilterByASingleLocationViaFlexform(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FilterByASingleLocationViaFlexform.php'); $request = new InternalRequest(); $request = $request->withPageId(1); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); @@ -39,17 +39,16 @@ public function canFilterByASingleLocationViaFlexform(): void self::assertStringContainsString('Was hat das Universum mit mir zu tun?', $html); } - /** - * @test - */ + #[Test] public function canFilterByTwoLocationsViaFlexform(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FilterByTwoLocationsViaFlexform.php'); $request = new InternalRequest(); $request = $request->withPageId(1); - $response = $this->executeFrontendRequest($request); + $response = $this->executeFrontendSubRequest($request); + $html = (string)$response->getBody(); self::assertSame(200, $response->getStatusCode()); $html = (string)$response->getBody(); diff --git a/Tests/Functional/Frontend/Fixtures/Extensions/example/Classes/UserFunc.php b/Tests/Functional/Frontend/Fixtures/Extensions/example/Classes/UserFunc.php index 3229059..adbc281 100644 --- a/Tests/Functional/Frontend/Fixtures/Extensions/example/Classes/UserFunc.php +++ b/Tests/Functional/Frontend/Fixtures/Extensions/example/Classes/UserFunc.php @@ -31,7 +31,7 @@ class UserFunc /** * @var ContentObjectRenderer */ - public $cObj; + protected $cObj; public function accessTsfeTimeout(): string { @@ -49,4 +49,9 @@ public function getTsfe(): TypoScriptFrontendController { return $GLOBALS['TSFE']; } + + public function setContentObjectRenderer(ContentObjectRenderer $cObj): void + { + $this->cObj = $cObj; + } } diff --git a/Tests/Functional/Frontend/Fixtures/Extensions/example/ext_localconf.php b/Tests/Functional/Frontend/Fixtures/Extensions/example/ext_localconf.php index c9439eb..c1bff1d 100644 --- a/Tests/Functional/Frontend/Fixtures/Extensions/example/ext_localconf.php +++ b/Tests/Functional/Frontend/Fixtures/Extensions/example/ext_localconf.php @@ -1,7 +1,10 @@ 'list'] + [DateController::class => 'list'] ); diff --git a/Tests/Functional/Import/DestinationDataTest/AbstractTest.php b/Tests/Functional/Import/DestinationDataTest/AbstractTestCase.php similarity index 90% rename from Tests/Functional/Import/DestinationDataTest/AbstractTest.php rename to Tests/Functional/Import/DestinationDataTest/AbstractTestCase.php index 4da8d08..f3a728d 100644 --- a/Tests/Functional/Import/DestinationDataTest/AbstractTest.php +++ b/Tests/Functional/Import/DestinationDataTest/AbstractTestCase.php @@ -4,7 +4,7 @@ use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; -abstract class AbstractTest extends AbstractFunctionalTestCase +abstract class AbstractTestCase extends AbstractFunctionalTestCase { protected function setUp(): void { diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv index ea23cb1..128ab45 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv @@ -1,23 +1,23 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,, +"tx_events_domain_model_organizer" ,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" ,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","dates",, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1",, -"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,, -,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0",,,,, -"sys_category",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent",,,,,,,,,, -,1,2,0,0,0,0,0,0,"Top Category",0,0,,,,,,,,,, -,2,2,0,0,0,0,0,0,"Event Category Parent",0,1,,,,,,,,,, -,3,2,0,0,0,0,0,0,"Weihnachten",0,2,,,,,,,,,, -"sys_category_record_mm",,,,,,,,,,,,,,,,,,,,, -,"uid_local","uid_foreign","tablenames","fieldname",,,,,,,,,,,,,,,,, -,3,1,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,, -"sys_file_metadata",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","title","description","alternative",,,,,,,,,,,,,,,, -,1,0,"This title is longer then the supported 255 chars as limited by default by TYPO3 database. Also c …","This is a supported description","This is a supported description",,,,,,,,,,,,,,,, -"sys_file_reference",,,,,,,,,,,,,,,,,,,,, -,"uid","uid_local","uid_foreign","tablenames","fieldname","title","description",,,,,,,,,,,,,, -,1,1,1,"tx_events_domain_model_event","images",,,,,,,,,,,,,,,, +"tx_events_domain_model_event" +,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","dates" +,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1" +"tx_events_domain_model_date" +,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link" +,"1","2","0","0","0","0",-1,0,"0","0","0","1","4101372000","4101377400","no","0", +"sys_category" +,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent" +,1,2,0,0,0,0,0,0,"Top Category",0,0 +,2,2,0,0,0,0,0,0,"Event Category Parent",0,1 +,3,2,0,0,0,0,0,0,"Weihnachten",0,2 +"sys_category_record_mm" +,"uid_local","uid_foreign","tablenames","fieldname" +,3,1,"tx_events_domain_model_event","categories" +"sys_file_metadata" +,"uid","pid","title","description","alternative" +,1,0,"This title is longer then the supported 255 chars as limited by default by TYPO3 database. Also c …","This is a supported description","This is a supported description" +"sys_file_reference" +,"uid","uid_local","uid_foreign","tablenames","fieldname" +,1,1,1,"tx_events_domain_model_event","images" diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.php new file mode 100644 index 0000000..7bb1678 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.php @@ -0,0 +1,134 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'dates' => '1', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '1', + 'start' => '4101372000', + 'end' => '4101377400', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + ], + 'sys_category' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Top Category', + 'items' => '0', + 'parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Event Category Parent', + 'items' => '0', + 'parent' => '1', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Weihnachten', + 'items' => '0', + 'parent' => '2', + ], + ], + 'sys_category_record_mm' => [ + 0 => [ + 'uid_local' => '3', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + ], + 'sys_file_metadata' => [ + 0 => [ + 'uid' => '1', + 'pid' => '0', + 'title' => 'This title is longer then the supported 255 chars as limited by default by TYPO3 database. Also c …', + 'description' => 'This is a supported description', + 'alternative' => 'This is a supported description', + ], + ], + 'sys_file_reference' => [ + 0 => [ + 'uid' => '1', + 'uid_local' => '1', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'images', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.csv new file mode 100644 index 0000000..853f9d1 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.csv @@ -0,0 +1,10 @@ +"tx_events_domain_model_organizer" +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" +"tx_events_domain_model_event" +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","dates" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"2" +"tx_events_domain_model_date" +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link" +,"1","2","0","0","0",-1,0,"0","0","0","1",1656748800,1656770400,"no","0", +,"2","2","0","0","0",-1,0,"0","0","0","1",1657353600,1657375200,"no","0", diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.php new file mode 100644 index 0000000..060af79 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreation.php @@ -0,0 +1,88 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'dates' => '2', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '1', + 'start' => '1656748800', + 'end' => '1656770400', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '1', + 'start' => '1657353600', + 'end' => '1657375200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv deleted file mode 100644 index c3912c1..0000000 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv +++ /dev/null @@ -1,10 +0,0 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","dates",, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"2",, -"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,, -,"1","2","0","0","0","0",-1,0,"0","0","0","1",1656748800,1656770400,"no","0",,,,, -,"2","2","0","0","0","0",-1,0,"0","0","0","1",1657353600,1657375200,"no","0",,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsMultipleImagestoSingleEvent.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsMultipleImagestoSingleEvent.php index ac102f4..f642ea7 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsMultipleImagestoSingleEvent.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsMultipleImagestoSingleEvent.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -17,7 +19,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -32,7 +34,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -45,7 +46,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 2, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImageToExistingImages.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImageToExistingImages.php index dae5ed0..17ea883 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImageToExistingImages.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImageToExistingImages.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -20,7 +22,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -33,7 +35,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/lutherkirche-jpg.jpg', 'extension' => 'jpg', 'name' => 'lutherkirche-jpg.jpg', @@ -51,7 +53,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -64,7 +65,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 3, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -77,7 +77,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 2, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImages.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImages.php index 6c866ed..d405f41 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImages.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesAddsNewImages.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -17,7 +19,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -27,7 +29,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/lutherkirche-jpg.jpg', 'extension' => 'jpg', 'name' => 'lutherkirche-jpg.jpg', @@ -42,7 +44,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -55,7 +56,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -68,7 +68,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesRemovesNoLongerExistingImages.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesRemovesNoLongerExistingImages.php index a011705..a9b6dcc 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesRemovesNoLongerExistingImages.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesRemovesNoLongerExistingImages.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -17,7 +19,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -32,7 +34,6 @@ 'tablenames' => '', 'fieldname' => '', 'sorting_foreign' => 0, - 'table_local' => '', 'title' => null, 'description' => null, 'alternative' => null, @@ -45,7 +46,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesExistingImage.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesExistingImage.php index ac102f4..f642ea7 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesExistingImage.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesExistingImage.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -17,7 +19,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -32,7 +34,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -45,7 +46,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 2, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesSortingOfImages.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesSortingOfImages.php index 97b3f65..047a0a2 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesSortingOfImages.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportHandlesImagesUpdatesSortingOfImages.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -17,7 +19,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -32,7 +34,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 2, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -45,7 +46,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.csv new file mode 100644 index 0000000..896f712 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.csv @@ -0,0 +1,61 @@ +"tx_events_domain_model_organizer" +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" +,"2","2","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de" +,"3","2","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",, +,"4","3","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" +,"5","3","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de" +,"6","3","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",, +"tx_events_domain_model_event" +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","images","categories","pages","dates","organizer","partner","region","references_events" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1","1",,"1","1",,"1", +,"2","2","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"1","1",,"4","2",,"1", +,"3","2","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"1","2",,"8","3",,"1", +,"4","3","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1","1",,"1","4",,"1", +,"5","3","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"1","1",,"4","5",,"1", +,"6","3","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"1","2",,"8","6",,"1", +"tx_events_domain_model_date" +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link" +,"1","2","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0", +,"2","2","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0", +,"3","2","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0", +,"4","2","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0", +,"5","2","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0", +,"6","2","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0", +,"7","2","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0", +,"8","2","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0", +,"9","2","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0", +,"10","2","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0", +,"11","2","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0", +,"12","2","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0", +,"13","2","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0", +,"14","3","0","0","0",-1,0,"0","0","0","4","1671458400","1671463800","no","0", +,"15","3","0","0","0",-1,0,"0","0","0","5","1671199200","1671204600","no","0", +,"16","3","0","0","0",-1,0,"0","0","0","5",1648803600,1648810800,"no","0", +,"17","3","0","0","0",-1,0,"0","0","0","5",1648890000,1648897200,"no","0", +,"18","3","0","0","0",-1,0,"0","0","0","5","1645106400","1645113600","no","0", +,"19","3","0","0","0",-1,0,"0","0","0","6","1669917600","1669921200","no","0", +,"20","3","0","0","0",-1,0,"0","0","0","6","1667642400","1667649600","no","0", +,"21","3","0","0","0",-1,0,"0","0","0","6","1668247200","1668254400","no","0", +,"22","3","0","0","0",-1,0,"0","0","0","6","1668852000","1668859200","no","0", +,"23","3","0","0","0",-1,0,"0","0","0","6","1667728800","1667736000","no","0", +,"24","3","0","0","0",-1,0,"0","0","0","6","1668333600","1668340800","no","0", +,"25","3","0","0","0",-1,0,"0","0","0","6","1668938400","1668945600","no","0", +,"26","3","0","0","0",-1,0,"0","0","0","6","1671732000","1671735600","no","0", +"sys_category" +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent" +,1,2,0,0,0,0,0,"Top Category",0,0 +,2,2,0,0,0,0,0,"Event Category Parent",0,1 +,3,2,0,0,0,0,0,"Weihnachten",0,2 +,4,2,0,0,0,0,0,"Kinder",0,2 +,5,2,0,0,0,0,0,"Konzerte, Festivals, Show & Tanz",0,2 +"sys_category_record_mm" +,"uid_local","uid_foreign","tablenames","fieldname" +,3,1,"tx_events_domain_model_event","categories" +,4,2,"tx_events_domain_model_event","categories" +,5,3,"tx_events_domain_model_event","categories" +,3,3,"tx_events_domain_model_event","categories" +,3,4,"tx_events_domain_model_event","categories" +,4,5,"tx_events_domain_model_event","categories" +,5,6,"tx_events_domain_model_event","categories" +,3,6,"tx_events_domain_model_event","categories" diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.php new file mode 100644 index 0000000..376774c --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfiguration.php @@ -0,0 +1,884 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '0 36 72 - 48 64 20', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de ', + 'email' => 'stadtbibliothek@rudolstadt.de', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '03672 - 48 96 13', + 'web' => '', + 'email' => '', + ], + 3 => [ + 'uid' => '4', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + 4 => [ + 'uid' => '5', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '0 36 72 - 48 64 20', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de ', + 'email' => 'stadtbibliothek@rudolstadt.de', + ], + 5 => [ + 'uid' => '6', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '03672 - 48 96 13', + 'web' => '', + 'email' => '', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '1', + 'organizer' => '1', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Tüftlerzeit', + 'subtitle' => '', + 'global_id' => 'e_100354481', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '4', + 'organizer' => '2', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)', + 'subtitle' => '', + 'global_id' => 'e_100350503', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '2', + 'pages' => '', + 'dates' => '8', + 'organizer' => '3', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + 3 => [ + 'uid' => '4', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '1', + 'organizer' => '4', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + 4 => [ + 'uid' => '5', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Tüftlerzeit', + 'subtitle' => '', + 'global_id' => 'e_100354481', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '4', + 'organizer' => '5', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + 5 => [ + 'uid' => '6', + 'pid' => '3', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)', + 'subtitle' => '', + 'global_id' => 'e_100350503', + 'highlight' => '0', + 'teaser' => '', + 'images' => '1', + 'categories' => '2', + 'pages' => '', + 'dates' => '8', + 'organizer' => '6', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '1', + 'start' => '1671458400', + 'end' => '1671463800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1671199200', + 'end' => '1671204600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1648803600', + 'end' => '1648810800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1648890000', + 'end' => '1648897200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1645106400', + 'end' => '1645113600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 5 => [ + 'uid' => '6', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1669917600', + 'end' => '1669921200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 6 => [ + 'uid' => '7', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1667642400', + 'end' => '1667649600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 7 => [ + 'uid' => '8', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668247200', + 'end' => '1668254400', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 8 => [ + 'uid' => '9', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668852000', + 'end' => '1668859200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 9 => [ + 'uid' => '10', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1667728800', + 'end' => '1667736000', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 10 => [ + 'uid' => '11', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668333600', + 'end' => '1668340800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 11 => [ + 'uid' => '12', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668938400', + 'end' => '1668945600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 12 => [ + 'uid' => '13', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1671732000', + 'end' => '1671735600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 13 => [ + 'uid' => '14', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '4', + 'start' => '1671458400', + 'end' => '1671463800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 14 => [ + 'uid' => '15', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '5', + 'start' => '1671199200', + 'end' => '1671204600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 15 => [ + 'uid' => '16', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '5', + 'start' => '1648803600', + 'end' => '1648810800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 16 => [ + 'uid' => '17', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '5', + 'start' => '1648890000', + 'end' => '1648897200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 17 => [ + 'uid' => '18', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '5', + 'start' => '1645106400', + 'end' => '1645113600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 18 => [ + 'uid' => '19', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1669917600', + 'end' => '1669921200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 19 => [ + 'uid' => '20', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1667642400', + 'end' => '1667649600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 20 => [ + 'uid' => '21', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1668247200', + 'end' => '1668254400', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 21 => [ + 'uid' => '22', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1668852000', + 'end' => '1668859200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 22 => [ + 'uid' => '23', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1667728800', + 'end' => '1667736000', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 23 => [ + 'uid' => '24', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1668333600', + 'end' => '1668340800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 24 => [ + 'uid' => '25', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1668938400', + 'end' => '1668945600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + 25 => [ + 'uid' => '26', + 'pid' => '3', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '6', + 'start' => '1671732000', + 'end' => '1671735600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + ], + ], + 'sys_category' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Top Category', + 'items' => '0', + 'parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Event Category Parent', + 'items' => '0', + 'parent' => '1', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Weihnachten', + 'items' => '0', + 'parent' => '2', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Kinder', + 'items' => '0', + 'parent' => '2', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Konzerte, Festivals, Show & Tanz', + 'items' => '0', + 'parent' => '2', + ], + ], + 'sys_category_record_mm' => [ + 0 => [ + 'uid_local' => '3', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 1 => [ + 'uid_local' => '4', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 2 => [ + 'uid_local' => '5', + 'uid_foreign' => '3', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 3 => [ + 'uid_local' => '3', + 'uid_foreign' => '3', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 4 => [ + 'uid_local' => '3', + 'uid_foreign' => '4', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 5 => [ + 'uid_local' => '4', + 'uid_foreign' => '5', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 6 => [ + 'uid_local' => '5', + 'uid_foreign' => '6', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 7 => [ + 'uid_local' => '3', + 'uid_foreign' => '6', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv deleted file mode 100644 index 52bd014..0000000 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv +++ /dev/null @@ -1,61 +0,0 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email",,,,, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,, -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,, -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,, -,"4","3","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,, -,"5","3","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,, -,"6","3","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,, -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","images","categories","pages","dates","organizer","partner","region","references_events" -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1","1",,"1","1",,"1", -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"1","1",,"4","2",,"1", -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"1","2",,"8","3",,"1", -,"4","3","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"1","1",,"1","4",,"1", -,"5","3","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"1","1",,"4","5",,"1", -,"6","3","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"1","2",,"8","6",,"1", -"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link",,,,,,,,, -,"1","2","0","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0",,,,,,,,,, -,"2","2","0","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0",,,,,,,,,, -,"3","2","0","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0",,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0",,,,,,,,,, -,"5","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,,,,,,,,, -,"6","2","0","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0",,,,,,,,,, -,"7","2","0","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0",,,,,,,,,, -,"8","2","0","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0",,,,,,,,,, -,"9","2","0","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0",,,,,,,,,, -,"10","2","0","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0",,,,,,,,,, -,"11","2","0","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0",,,,,,,,,, -,"12","2","0","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0",,,,,,,,,, -,"13","2","0","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0",,,,,,,,,, -,"14","3","0","0","0","0",-1,0,"0","0","0","4","1671458400","1671463800","no","0",,,,,,,,,, -,"15","3","0","0","0","0",-1,0,"0","0","0","5","1671199200","1671204600","no","0",,,,,,,,,, -,"16","3","0","0","0","0",-1,0,"0","0","0","5",1648803600,1648810800,"no","0",,,,,,,,,, -,"17","3","0","0","0","0",-1,0,"0","0","0","5",1648890000,1648897200,"no","0",,,,,,,,,, -,"18","3","0","0","0","0",-1,0,"0","0","0","5","1645106400","1645113600","no","0",,,,,,,,,, -,"19","3","0","0","0","0",-1,0,"0","0","0","6","1669917600","1669921200","no","0",,,,,,,,,, -,"20","3","0","0","0","0",-1,0,"0","0","0","6","1667642400","1667649600","no","0",,,,,,,,,, -,"21","3","0","0","0","0",-1,0,"0","0","0","6","1668247200","1668254400","no","0",,,,,,,,,, -,"22","3","0","0","0","0",-1,0,"0","0","0","6","1668852000","1668859200","no","0",,,,,,,,,, -,"23","3","0","0","0","0",-1,0,"0","0","0","6","1667728800","1667736000","no","0",,,,,,,,,, -,"24","3","0","0","0","0",-1,0,"0","0","0","6","1668333600","1668340800","no","0",,,,,,,,,, -,"25","3","0","0","0","0",-1,0,"0","0","0","6","1668938400","1668945600","no","0",,,,,,,,,, -,"26","3","0","0","0","0",-1,0,"0","0","0","6","1671732000","1671735600","no","0",,,,,,,,,, -"sys_category",,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent",,,,,,,,,,,,,,, -,1,2,0,0,0,0,0,0,"Top Category",0,0,,,,,,,,,,,,,,, -,2,2,0,0,0,0,0,0,"Event Category Parent",0,1,,,,,,,,,,,,,,, -,3,2,0,0,0,0,0,0,"Weihnachten",0,2,,,,,,,,,,,,,,, -,4,2,0,0,0,0,0,0,"Kinder",0,2,,,,,,,,,,,,,,, -,5,2,0,0,0,0,0,0,"Konzerte, Festivals, Show & Tanz",0,2,,,,,,,,,,,,,,, -"sys_category_record_mm",,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid_local","uid_foreign","tablenames","fieldname",,,,,,,,,,,,,,,,,,,,,, -,3,1,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,4,2,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,5,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,3,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,3,4,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,4,5,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,5,6,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, -,3,6,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv index f3376db..c9947ce 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv @@ -1,49 +1,49 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email",,,,,,,,,,,,,,, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,,,,,,,,,,,, -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,,,,,,,,,,,, -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,,,,,,,,,,,, -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","slug","highlight","teaser","details","price_info","web","ticket","facebook","youtube","instagram","images","categories","pages","dates","organizer","partner","region","references_events","location","slug" -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","e-100347853","0",,"Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert. +"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email",,,,,,,,,,,,,,, +,"1","2","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de",,,,,,,,,,,,,,, +,"2","2","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de",,,,,,,,,,,,,,, +,"3","2","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",,,,,,,,,,,,,,,,, +"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","slug","highlight","teaser","details","price_info","web","ticket","facebook","youtube","instagram","images","categories","pages","dates","organizer","partner","region","references_events","location","slug" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","e-100347853","0",,"Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert. Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke) Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten. Es gilt die 2G-PLUS-Regel.",,"http://www.schillerhaus.rudolstadt.de/",,,,,"1","1",,"1","1",,"1",,1,"allerlei-weihnachtliches-heute-mit-johannes-geisser" -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","e-100354481","0",,"Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein. +,"2","2","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","e-100354481","0",,"Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein. Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420 Bitte beachten Sie die derzeit geltenden Zugangsregeln.",,"http://www.stadtbibliothek-rudolstadt.de/",,,,,"1","1",,"4","2",,"1",,2,"tueftlerzeit" -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss. +,"3","2","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","e-100350503","0",,"Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss. Es gilt die 2G-PLUS-Regel.",,,,,,,"1","2",,"8","3",,"1",,3,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen" -"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link","slug",,,,,,,,,,,,,,,,,, -,"1","2","0","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0",,"allerlei-weihnachtliches-heute-mit-johannes-geisser-2022-12-19t14-00-00",,,,,,,,,,,,,,,,,, -,"2","2","0","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0",,"tueftlerzeit-2022-12-16t14-00-00",,,,,,,,,,,,,,,,,, -,"3","2","0","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0",,"tueftlerzeit-2022-04-01t09-00-00",,,,,,,,,,,,,,,,,, -,"4","2","0","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0",,"tueftlerzeit-2022-04-02t09-00-00",,,,,,,,,,,,,,,,,, -,"5","2","0","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,"tueftlerzeit-2022-02-17t14-00-00",,,,,,,,,,,,,,,,,, -,"6","2","0","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-01t18-00-00",,,,,,,,,,,,,,,,,, -,"7","2","0","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-05t10-00-00",,,,,,,,,,,,,,,,,, -,"8","2","0","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-12t10-00-00",,,,,,,,,,,,,,,,,, -,"9","2","0","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-19t10-00-00",,,,,,,,,,,,,,,,,, -,"10","2","0","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-06t10-00-00",,,,,,,,,,,,,,,,,, -,"11","2","0","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-13t10-00-00",,,,,,,,,,,,,,,,,, -,"12","2","0","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-20t10-00-00",,,,,,,,,,,,,,,,,, -,"13","2","0","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-22t18-00-00",,,,,,,,,,,,,,,,,, -"tx_events_domain_model_location",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","name","street","district","city","zip","country","latitude","longitude","phone",,,,,,,,,,,,,,,, -,"1","2","0","0","0","0",-1,0,"0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","50.720971","11.335230","+ 49 3672 / 486470",,,,,,,,,,,,,,,, -,"2","2","0","0","0","0",-1,0,"0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","Deutschland","50.720835","11.342568","0 36 72 - 48 64 20",,,,,,,,,,,,,,,, -,"3","2","0","0","0","0",-1,0,"0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland","50.718689","11.327333","03672 - 48 96 13",,,,,,,,,,,,,,,, -"sys_category",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent",,,,,,,,,,,,,,,,,,,,,,,,, -,1,2,0,0,0,0,0,0,"Top Category",0,0,,,,,,,,,,,,,,,,,,,,,,,,, -,2,2,0,0,0,0,0,0,"Event Category Parent",0,1,,,,,,,,,,,,,,,,,,,,,,,,, -,3,2,0,0,0,0,0,0,"Weihnachten",0,2,,,,,,,,,,,,,,,,,,,,,,,,, -,4,2,0,0,0,0,0,0,"Kinder",0,2,,,,,,,,,,,,,,,,,,,,,,,,, -,5,2,0,0,0,0,0,0,"Konzerte, Festivals, Show & Tanz",0,2,,,,,,,,,,,,,,,,,,,,,,,,, -"sys_category_record_mm",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,"uid_local","uid_foreign","tablenames","fieldname",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,3,1,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,4,2,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,5,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -,3,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"tx_events_domain_model_date",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","event","start","end","canceled","postponed_date","canceled_link","slug",,,,,,,,,,,,,,,,,, +,"1","2","0","0","0",-1,0,"0","0","0","1","1671458400","1671463800","no","0",,"allerlei-weihnachtliches-heute-mit-johannes-geisser-2022-12-19t14-00-00",,,,,,,,,,,,,,,,,, +,"2","2","0","0","0",-1,0,"0","0","0","2","1671199200","1671204600","no","0",,"tueftlerzeit-2022-12-16t14-00-00",,,,,,,,,,,,,,,,,, +,"3","2","0","0","0",-1,0,"0","0","0","2",1648803600,1648810800,"no","0",,"tueftlerzeit-2022-04-01t09-00-00",,,,,,,,,,,,,,,,,, +,"4","2","0","0","0",-1,0,"0","0","0","2",1648890000,1648897200,"no","0",,"tueftlerzeit-2022-04-02t09-00-00",,,,,,,,,,,,,,,,,, +,"5","2","0","0","0",-1,0,"0","0","0","2","1645106400","1645113600","no","0",,"tueftlerzeit-2022-02-17t14-00-00",,,,,,,,,,,,,,,,,, +,"6","2","0","0","0",-1,0,"0","0","0","3","1669917600","1669921200","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-01t18-00-00",,,,,,,,,,,,,,,,,, +,"7","2","0","0","0",-1,0,"0","0","0","3","1667642400","1667649600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-05t10-00-00",,,,,,,,,,,,,,,,,, +,"8","2","0","0","0",-1,0,"0","0","0","3","1668247200","1668254400","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-12t10-00-00",,,,,,,,,,,,,,,,,, +,"9","2","0","0","0",-1,0,"0","0","0","3","1668852000","1668859200","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-19t10-00-00",,,,,,,,,,,,,,,,,, +,"10","2","0","0","0",-1,0,"0","0","0","3","1667728800","1667736000","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-06t10-00-00",,,,,,,,,,,,,,,,,, +,"11","2","0","0","0",-1,0,"0","0","0","3","1668333600","1668340800","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-13t10-00-00",,,,,,,,,,,,,,,,,, +,"12","2","0","0","0",-1,0,"0","0","0","3","1668938400","1668945600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-20t10-00-00",,,,,,,,,,,,,,,,,, +,"13","2","0","0","0",-1,0,"0","0","0","3","1671732000","1671735600","no","0",,"adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-22t18-00-00",,,,,,,,,,,,,,,,,, +"tx_events_domain_model_location",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","name","street","district","city","zip","country","latitude","longitude","phone",,,,,,,,,,,,,,,, +,"1","2","0","0","0",-1,0,"0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","50.720971","11.335230","+ 49 3672 / 486470",,,,,,,,,,,,,,,, +,"2","2","0","0","0",-1,0,"0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","Deutschland","50.720835","11.342568","0 36 72 - 48 64 20",,,,,,,,,,,,,,,, +,"3","2","0","0","0",-1,0,"0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","Deutschland","50.718689","11.327333","03672 - 48 96 13",,,,,,,,,,,,,,,, +"sys_category",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid","pid","hidden","starttime","endtime","sys_language_uid","l10n_parent","title","items","parent",,,,,,,,,,,,,,,,,,,,,,,,, +,1,2,0,0,0,0,0,"Top Category",0,0,,,,,,,,,,,,,,,,,,,,,,,,, +,2,2,0,0,0,0,0,"Event Category Parent",0,1,,,,,,,,,,,,,,,,,,,,,,,,, +,3,2,0,0,0,0,0,"Weihnachten",0,2,,,,,,,,,,,,,,,,,,,,,,,,, +,4,2,0,0,0,0,0,"Kinder",0,2,,,,,,,,,,,,,,,,,,,,,,,,, +,5,2,0,0,0,0,0,"Konzerte, Festivals, Show & Tanz",0,2,,,,,,,,,,,,,,,,,,,,,,,,, +"sys_category_record_mm",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,"uid_local","uid_foreign","tablenames","fieldname",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,3,1,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,4,2,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,5,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,3,3,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.php new file mode 100644 index 0000000..455d0ef --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.php @@ -0,0 +1,596 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '0 36 72 - 48 64 20', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de ', + 'email' => 'stadtbibliothek@rudolstadt.de', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '03672 - 48 96 13', + 'web' => '', + 'email' => '', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'slug' => 'allerlei-weihnachtliches-heute-mit-johannes-geisser', + 'highlight' => '0', + 'teaser' => '', + 'details' => implode(PHP_EOL, [ + 'Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.', + 'Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)', + 'Um Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.', + 'Es gilt die 2G-PLUS-Regel.', + ]), + 'price_info' => '', + 'web' => 'http://www.schillerhaus.rudolstadt.de/', + 'ticket' => '', + 'facebook' => '', + 'youtube' => '', + 'instagram' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '1', + 'organizer' => '1', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + 'location' => '1', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Tüftlerzeit', + 'subtitle' => '', + 'global_id' => 'e_100354481', + 'slug' => 'tueftlerzeit', + 'highlight' => '0', + 'teaser' => '', + 'details' => implode(PHP_EOL, [ + 'Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.', + 'Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420', + 'Bitte beachten Sie die derzeit geltenden Zugangsregeln.', + ]), + 'price_info' => '', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de/', + 'ticket' => '', + 'facebook' => '', + 'youtube' => '', + 'instagram' => '', + 'images' => '1', + 'categories' => '1', + 'pages' => '', + 'dates' => '4', + 'organizer' => '2', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + 'location' => '2', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)', + 'subtitle' => '', + 'global_id' => 'e_100350503', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen', + 'highlight' => '0', + 'teaser' => '', + 'details' => implode(PHP_EOL, [ + 'Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.', + 'Es gilt die 2G-PLUS-Regel.', + ]), + 'price_info' => '', + 'web' => '', + 'ticket' => '', + 'facebook' => '', + 'youtube' => '', + 'instagram' => '', + 'images' => '1', + 'categories' => '2', + 'pages' => '', + 'dates' => '8', + 'organizer' => '3', + 'partner' => '', + 'region' => '1', + 'references_events' => '', + 'location' => '3', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '1', + 'start' => '1671458400', + 'end' => '1671463800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'allerlei-weihnachtliches-heute-mit-johannes-geisser-2022-12-19t14-00-00', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1671199200', + 'end' => '1671204600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'tueftlerzeit-2022-12-16t14-00-00', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1648803600', + 'end' => '1648810800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'tueftlerzeit-2022-04-01t09-00-00', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1648890000', + 'end' => '1648897200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'tueftlerzeit-2022-04-02t09-00-00', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '2', + 'start' => '1645106400', + 'end' => '1645113600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'tueftlerzeit-2022-02-17t14-00-00', + ], + 5 => [ + 'uid' => '6', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1669917600', + 'end' => '1669921200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-01t18-00-00', + ], + 6 => [ + 'uid' => '7', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1667642400', + 'end' => '1667649600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-05t10-00-00', + ], + 7 => [ + 'uid' => '8', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668247200', + 'end' => '1668254400', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-12t10-00-00', + ], + 8 => [ + 'uid' => '9', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668852000', + 'end' => '1668859200', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-19t10-00-00', + ], + 9 => [ + 'uid' => '10', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1667728800', + 'end' => '1667736000', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-06t10-00-00', + ], + 10 => [ + 'uid' => '11', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668333600', + 'end' => '1668340800', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-13t10-00-00', + ], + 11 => [ + 'uid' => '12', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1668938400', + 'end' => '1668945600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-11-20t10-00-00', + ], + 12 => [ + 'uid' => '13', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'event' => '3', + 'start' => '1671732000', + 'end' => '1671735600', + 'canceled' => 'no', + 'postponed_date' => '0', + 'canceled_link' => '', + 'slug' => 'adventliche-orgelmusik-orgel-kmd-frank-bettenhausen-2022-12-22t18-00-00', + ], + ], + 'tx_events_domain_model_location' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'country' => 'Deutschland', + 'latitude' => '50.720971', + 'longitude' => '11.335230', + 'phone' => '+ 49 3672 / 486470', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'country' => 'Deutschland', + 'latitude' => '50.720835', + 'longitude' => '11.342568', + 'phone' => '0 36 72 - 48 64 20', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'country' => 'Deutschland', + 'latitude' => '50.718689', + 'longitude' => '11.327333', + 'phone' => '03672 - 48 96 13', + ], + ], + 'sys_category' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Top Category', + 'items' => '0', + 'parent' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Event Category Parent', + 'items' => '0', + 'parent' => '1', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Weihnachten', + 'items' => '0', + 'parent' => '2', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Kinder', + 'items' => '0', + 'parent' => '2', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '0', + 'l10n_parent' => '0', + 'title' => 'Konzerte, Festivals, Show & Tanz', + 'items' => '0', + 'parent' => '2', + ], + ], + 'sys_category_record_mm' => [ + 0 => [ + 'uid_local' => '3', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 1 => [ + 'uid_local' => '4', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 2 => [ + 'uid_local' => '5', + 'uid_foreign' => '3', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + 3 => [ + 'uid_local' => '3', + 'uid_foreign' => '3', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'categories', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.php new file mode 100644 index 0000000..d424af1 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.php @@ -0,0 +1,175 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'features' => '6', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'features' => '4', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'features' => '0', + ], + ], + 'sys_category' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Top Category', + 'parent' => '0', + 'hidden' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'title' => 'Event Category Parent', + 'parent' => '1', + 'hidden' => '0', + ], + 2 => [ + 'uid' => '4', + 'pid' => '2', + 'title' => 'Event Feature Parent', + 'parent' => '1', + 'hidden' => '0', + ], + 3 => [ + 'uid' => '5', + 'pid' => '3', + 'title' => 'vorhandenes Feature', + 'parent' => '4', + 'hidden' => '1', + ], + 4 => [ + 'uid' => '6', + 'pid' => '3', + 'title' => 'Barrierefrei', + 'parent' => '4', + 'hidden' => '1', + ], + 5 => [ + 'uid' => '7', + 'pid' => '3', + 'title' => 'Zielgruppe Jugendliche', + 'parent' => '4', + 'hidden' => '1', + ], + 6 => [ + 'uid' => '8', + 'pid' => '3', + 'title' => 'Karten an der Abendkasse', + 'parent' => '4', + 'hidden' => '1', + ], + 7 => [ + 'uid' => '9', + 'pid' => '3', + 'title' => 'Ausreichende Lüftung', + 'parent' => '4', + 'hidden' => '1', + ], + 8 => [ + 'uid' => '10', + 'pid' => '3', + 'title' => 'Beachtung der Hygienehinweise', + 'parent' => '4', + 'hidden' => '1', + ], + 9 => [ + 'uid' => '11', + 'pid' => '3', + 'title' => 'neues Feature', + 'parent' => '4', + 'hidden' => '1', + ], + ], + 'sys_category_record_mm' => [ + 0 => [ + 'uid_local' => '5', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '1', + ], + 1 => [ + 'uid_local' => '6', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '2', + ], + 2 => [ + 'uid_local' => '7', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '3', + ], + 3 => [ + 'uid_local' => '8', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '4', + ], + 4 => [ + 'uid_local' => '9', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '5', + ], + 5 => [ + 'uid_local' => '10', + 'uid_foreign' => '1', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '6', + ], + 6 => [ + 'uid_local' => '5', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '1', + ], + 7 => [ + 'uid_local' => '6', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '2', + ], + 8 => [ + 'uid_local' => '7', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '3', + ], + 9 => [ + 'uid_local' => '11', + 'uid_foreign' => '2', + 'tablenames' => 'tx_events_domain_model_event', + 'fieldname' => 'features', + 'sorting' => '0', + 'sorting_foreign' => '4', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.php new file mode 100644 index 0000000..6b956a4 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.php @@ -0,0 +1,50 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Kurzführung - Historische Altstadt', + 'global_id' => 'e_100354481', + 'dates' => '5', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1657720800', + 'end' => '1657724400', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '1', + 'start' => '1657807200', + 'end' => '1657810800', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'event' => '1', + 'start' => '1657893600', + 'end' => '1657897200', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'event' => '1', + 'start' => '1657980000', + 'end' => '1657983600', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'event' => '1', + 'start' => '1658066400', + 'end' => '1658070000', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.php new file mode 100644 index 0000000..46495ba --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.php @@ -0,0 +1,36 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Tüftlerzeit', + 'global_id' => 'e_100354481', + 'dates' => '3', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1657958400', + 'end' => '1657980000', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '1', + 'start' => '1658563200', + 'end' => '1658584800', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'event' => '1', + 'start' => '1659168000', + 'end' => '1659189600', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.php new file mode 100644 index 0000000..6e21d8b --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.php @@ -0,0 +1,22 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Kurzführung - Historische Altstadt', + 'global_id' => 'e_100354481', + 'dates' => '1', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1657717200', + 'end' => '1657722600', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.php new file mode 100644 index 0000000..eb8a4e8 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.php @@ -0,0 +1,85 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Kurzführung - Historische Altstadt', + 'global_id' => 'e_100354481', + 'dates' => '10', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1657720800', + 'end' => '1657724400', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '1', + 'start' => '1657807200', + 'end' => '1657810800', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'event' => '1', + 'start' => '1657893600', + 'end' => '1657897200', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'event' => '1', + 'start' => '1657980000', + 'end' => '1657983600', + ], + 4 => [ + 'uid' => '5', + 'pid' => '2', + 'event' => '1', + 'start' => '1658066400', + 'end' => '1658070000', + ], + 5 => [ + 'uid' => '6', + 'pid' => '2', + 'event' => '1', + 'start' => '1658152800', + 'end' => '1658156400', + ], + 6 => [ + 'uid' => '7', + 'pid' => '2', + 'event' => '1', + 'start' => '1658239200', + 'end' => '1658242800', + ], + 7 => [ + 'uid' => '8', + 'pid' => '2', + 'event' => '1', + 'start' => '1658325600', + 'end' => '1658329200', + ], + 8 => [ + 'uid' => '9', + 'pid' => '2', + 'event' => '1', + 'start' => '1658412000', + 'end' => '1658415600', + ], + 9 => [ + 'uid' => '10', + 'pid' => '2', + 'event' => '1', + 'start' => '1658498400', + 'end' => '1658502000', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.php new file mode 100644 index 0000000..f8cf452 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.php @@ -0,0 +1,43 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'Tüftlerzeit', + 'global_id' => 'e_100354481', + 'dates' => '4', + ], + ], + 'tx_events_domain_model_date' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'event' => '1', + 'start' => '1657958400', + 'end' => '1657980000', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'event' => '1', + 'start' => '1658563200', + 'end' => '1658584800', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'event' => '1', + 'start' => '1659168000', + 'end' => '1659189600', + ], + 3 => [ + 'uid' => '4', + 'pid' => '2', + 'event' => '1', + 'start' => '1659772800', + 'end' => '1659794400', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.php new file mode 100644 index 0000000..c118828 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.php @@ -0,0 +1,20 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'title' => 'PRICE_KARTENLINK', + 'global_id' => 'e_100347853', + 'ticket' => 'https://www.ticketshop-thueringen.de/veranstaltungen/comedy/sonstiges/bodo-wartke-24230', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'title' => 'Booking', + 'global_id' => 'e_100354481', + 'ticket' => 'https://www.erfurt-tourismus.de/stadtfuehrung/individuell/altstadtfuehrung/onlinebuchung-altstadtfuehrung', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.php index 63feb36..444edea 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.php +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.php @@ -5,7 +5,6 @@ [ 'uid' => 1, 'pid' => 2, - 'cruser_id' => 0, 'hidden' => 0, 'starttime' => 0, 'endtime' => 0, @@ -28,7 +27,6 @@ [ 'uid' => 2, 'pid' => 2, - 'cruser_id' => 0, 'hidden' => 0, 'starttime' => 0, 'endtime' => 0, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.php new file mode 100644 index 0000000..6901c81 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.php @@ -0,0 +1,134 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '0 36 72 - 48 64 20', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de ', + 'email' => 'stadtbibliothek@rudolstadt.de', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '03672 - 48 96 13', + 'web' => '', + 'email' => '', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'categories' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Tüftlerzeit', + 'subtitle' => '', + 'global_id' => 'e_100354481', + 'highlight' => '0', + 'teaser' => '', + 'categories' => '0', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)', + 'subtitle' => '', + 'global_id' => 'e_100350503', + 'highlight' => '0', + 'teaser' => '', + 'categories' => '0', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv index 334ef94..18f884a 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv @@ -1,6 +1,6 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","region",, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"0",, +"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" +"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","region",, +,"1","2","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"0",, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.php new file mode 100644 index 0000000..c9fbc41 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.php @@ -0,0 +1,50 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'region' => '0', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv index 359aaf8..ca51f55 100644 --- a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv @@ -1,10 +1,10 @@ -"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de" -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",, -"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,,, -,"uid","pid","cruser_id","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","region",, -,"1","2","0","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"0",, -,"2","2","0","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"0",, -,"3","2","0","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"0",, +"tx_events_domain_model_organizer",,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","name","street","district","city","zip","phone","web","email" +,"1","2","0","0","0","0","-1","0","0","0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","+ 49 3672 / 486470","http://schillerhaus.rudolstadt.de","schillerhaus@rudolstadt.de" +,"2","2","0","0","0","0","-1","0","0","0","0","0","Stadtbibliothek Rudolstadt","Schulplatz 13",,"Rudolstadt","07407","0 36 72 - 48 64 20","http://www.stadtbibliothek-rudolstadt.de ","stadtbibliothek@rudolstadt.de" +,"3","2","0","0","0","0","-1","0","0","0","0","0","Lutherkirche","Caspar-Schulte-Straße",,"Rudolstadt","07407","03672 - 48 96 13",, +"tx_events_domain_model_event",,,,,,,,,,,,,,,,,,,, +,"uid","pid","deleted","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","title","subtitle","global_id","highlight","teaser","region",, +,"1","2","0","0","0","0","-1","0","0","0","0","0","Allerlei Weihnachtliches (Heute mit Johannes Geißer)",,"e_100347853","0",,"0",, +,"2","2","0","0","0","0","-1","0","0","0","0","0","Tüftlerzeit",,"e_100354481","0",,"0",, +,"3","2","0","0","0","0","-1","0","0","0","0","0","Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",,"e_100350503","0",,"0",, diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.php new file mode 100644 index 0000000..d51afad --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.php @@ -0,0 +1,134 @@ + [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Schillerhaus Rudolstadt', + 'street' => 'Schillerstraße 25', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '+ 49 3672 / 486470', + 'web' => 'http://schillerhaus.rudolstadt.de', + 'email' => 'schillerhaus@rudolstadt.de', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Stadtbibliothek Rudolstadt', + 'street' => 'Schulplatz 13', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '0 36 72 - 48 64 20', + 'web' => 'http://www.stadtbibliothek-rudolstadt.de ', + 'email' => 'stadtbibliothek@rudolstadt.de', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'name' => 'Lutherkirche', + 'street' => 'Caspar-Schulte-Straße', + 'district' => '', + 'city' => 'Rudolstadt', + 'zip' => '07407', + 'phone' => '03672 - 48 96 13', + 'web' => '', + 'email' => '', + ], + ], + 'tx_events_domain_model_event' => [ + 0 => [ + 'uid' => '1', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Allerlei Weihnachtliches (Heute mit Johannes Geißer)', + 'subtitle' => '', + 'global_id' => 'e_100347853', + 'highlight' => '0', + 'teaser' => '', + 'region' => '0', + ], + 1 => [ + 'uid' => '2', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Tüftlerzeit', + 'subtitle' => '', + 'global_id' => 'e_100354481', + 'highlight' => '0', + 'teaser' => '', + 'region' => '0', + ], + 2 => [ + 'uid' => '3', + 'pid' => '2', + 'deleted' => '0', + 'hidden' => '0', + 'starttime' => '0', + 'endtime' => '0', + 'sys_language_uid' => '-1', + 'l10n_parent' => '0', + 't3ver_oid' => '0', + 't3ver_wsid' => '0', + 't3ver_state' => '0', + 't3ver_stage' => '0', + 'title' => 'Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)', + 'subtitle' => '', + 'global_id' => 'e_100350503', + 'highlight' => '0', + 'teaser' => '', + 'region' => '0', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportHandlesImagesExistingData.php b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportHandlesImagesExistingData.php index 2d6eaa6..60fc702 100644 --- a/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportHandlesImagesExistingData.php +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/Database/ImportHandlesImagesExistingData.php @@ -1,5 +1,7 @@ [ [ @@ -7,7 +9,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', 'extension' => 'jpg', 'name' => 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', @@ -20,7 +22,7 @@ 'pid' => 0, 'missing' => 0, 'storage' => 1, - 'type' => \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE, + 'type' => File::FILETYPE_IMAGE, 'identifier' => '/staedte/beispielstadt/events/tueftlerzeit-sfz-rudolstadt-jpg.jpg', 'extension' => 'jpg', 'name' => 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', @@ -38,7 +40,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 1, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, @@ -51,7 +52,6 @@ 'tablenames' => 'tx_events_domain_model_event', 'fieldname' => 'images', 'sorting_foreign' => 2, - 'table_local' => 'sys_file', 'title' => null, 'description' => null, 'alternative' => null, diff --git a/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFiles.php b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFiles.php new file mode 100644 index 0000000..d57508f --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFiles.php @@ -0,0 +1,62 @@ +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') ?: ''), + new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''), + new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''), + new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ExampleImage.jpg') ?: ''), + ]); + + $tester = $this->executeCommand(); + + 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()); + + $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); + self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); + self::assertSame( + [ + 'lutherkirche-jpg.jpg', + 'theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg', + 'tueftlerzeit-sfz-rudolstadt-jpg.jpg', + ], + array_values($importedFiles), + 'Got unexpected number of files' + ); + + $transientFiles = GeneralUtility::getFilesInDir(Environment::getVarPath() . '/transient/'); + self::assertIsArray($transientFiles, 'Failed to retrieve transient files from filesystem.'); + self::assertCount(0, $transientFiles, 'Got unexpected number of files'); + + $this->assertEmptyLog(); + } +} diff --git a/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php index 3d9c79d..d57508f 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportCleansTransientFilesTest.php @@ -3,17 +3,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportCleansTransientFilesTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportCleansTransientFilesTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function cleansTransientFiles(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php index b307aff..c92a4b1 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesNotUseUploadsFolderTest.php @@ -3,17 +3,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportDoesNotUseUploadsFolderTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportDoesNotUseUploadsFolderTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function doesNotUseUploadsFolder(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php index 168c414..2a4dce5 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesntBreakWithLongFileTitleTest.php @@ -3,12 +3,11 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; -class ImportDoesntBreakWithLongFileTitleTest extends AbstractTest +class ImportDoesntBreakWithLongFileTitleTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsExampleAsExpected(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php'); @@ -32,7 +31,7 @@ public function importsExampleAsExpected(): void self::assertSame(0, $tester->getStatusCode()); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntBreakWithLongFileTitle.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportDoesntBreakWithLongFileTitle.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php index 9baa6cc..8d740f9 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportDoesntEndUpInEndlessDateCreationTest.php @@ -2,16 +2,16 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; -class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTest +class ImportDoesntEndUpInEndlessDateCreationTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsExampleAsExpected(): void { - $this->setDateAspect(new \DateTimeImmutable('2022-07-01'), new \DateTimeZone('Europe/Berlin')); + $this->setDateAspect(new DateTimeImmutable('2022-07-01')); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); @@ -32,7 +32,7 @@ public function importsExampleAsExpected(): void self::assertSame(0, $tester->getStatusCode()); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportDoesntEndUpInEndlessDateCreationTest.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportDoesntEndUpInEndlessDateCreation.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php index 51073ee..a704f95 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportHandlesImagesTest.php @@ -3,12 +3,12 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportHandlesImagesTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportHandlesImagesTest extends AbstractTestCase { protected function setUp(): void { @@ -29,9 +29,7 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function addsNewImages(): void { $this->setUpResponses([ @@ -60,9 +58,7 @@ public function addsNewImages(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function addsMultipleImagesToSingleEvent(): void { $this->setUpResponses([ @@ -89,9 +85,7 @@ public function addsMultipleImagesToSingleEvent(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function removesNoLongerExistingImages(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ImportHandlesImagesExistingData.php'); @@ -121,9 +115,7 @@ public function removesNoLongerExistingImages(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function updatesExistingImage(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ImportHandlesImagesExistingData.php'); @@ -154,9 +146,7 @@ public function updatesExistingImage(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function addsNewImageToExistingImages(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ImportHandlesImagesExistingData.php'); @@ -189,9 +179,7 @@ public function addsNewImageToExistingImages(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function updatesSortingOfImages(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ImportHandlesImagesExistingData.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php index f7f4ef7..e1d6114 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsAllConfigurationTest.php @@ -2,21 +2,21 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; +use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; use WerkraumMedia\Events\Command\ImportDestinationDataViaAllConfigruationsCommand; -/** - * @testdox Import of configuration - */ -class ImportsAllConfigurationTest extends AbstractTest +#[TestDox('Import of configuration')] +class ImportsAllConfigurationTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsConfiguration(): void { - $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); + $this->setDateAspect(new DateTimeImmutable('2021-07-13', new DateTimeZone('Europe/Berlin'))); $fileImportPathConfiguration2 = 'staedte/anderestadt/events/'; $fileImportPath2 = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration2; @@ -72,7 +72,7 @@ public function importsConfiguration(): void $this->getAllRecords('tx_events_domain_model_region'), 'Added or removed unexpected region.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsAllConfigurationTest.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsAllConfiguration.php'); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php index 9f72e77..63acbc3 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php @@ -2,13 +2,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; +use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportsExampleAsExpectedTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsExampleAsExpectedTest extends AbstractTestCase { protected function setUp(): void { @@ -24,12 +26,10 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function importsExampleAsExpected(): void { - $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); + $this->setDateAspect(new DateTimeImmutable('2021-07-13', new DateTimeZone('Europe/Berlin'))); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithCategories.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); @@ -62,7 +62,7 @@ public function importsExampleAsExpected(): void $this->getAllRecords('tx_events_domain_model_region'), 'Added or removed unexpected region.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsExampleAsExpected.php'); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); @@ -79,9 +79,7 @@ public function importsExampleAsExpected(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function importsSource(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php index 490c457..10b57f1 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsFeaturesTest.php @@ -3,16 +3,13 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -class ImportsFeaturesTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsFeaturesTest extends AbstractTestCase { - /** - * @test - * Only 1 associated feature count as other features are new and hidden and not counted. - */ + #[Test] public function addsNewFeatures(): void { $this->setUpConfiguration([ @@ -24,13 +21,11 @@ public function addsNewFeatures(): void ]); $tester = $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsFeaturesAddsNewFeatures.php'); $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function addsNewFeaturesToExistingOnes(): void { $this->setUpConfiguration([ @@ -43,7 +38,7 @@ public function addsNewFeaturesToExistingOnes(): void ]); $tester = $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFeaturesAddsNewFeatures.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsFeaturesAddsNewFeatures.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php index 0a6d116..812376c 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsFirstDateOfDatesTest.php @@ -2,12 +2,14 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; +use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -class ImportsFirstDateOfDatesTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsFirstDateOfDatesTest extends AbstractTestCase { public function setUp(): void { @@ -17,45 +19,39 @@ public function setUp(): void 'restUrl = https://example.com/some-path/', ]); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/FirstDateOfRecurringDatesImportConfiguration.php'); - $this->setDateAspect(new \DateTimeImmutable('2022-07-13', new \DateTimeZone('UTC'))); + $this->setDateAspect(new DateTimeImmutable('2022-07-13', new DateTimeZone('UTC'))); } - /** - * @test - */ + #[Test] public function singelDate(): void { $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithSingleDate.json') ?: '')]); $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfSingleDate.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsFirstDateOfSingleDate.php'); $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function recurringWeekly(): void { $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringWeekly.json') ?: '')]); $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesWeekly.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsFirstDateOfRecurringDatesWeekly.php'); $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function recurringDaily(): void { $this->setUpResponses([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithRecurringDaily.json') ?: '')]); $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsFirstDateOfRecurringDatesDaily.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsFirstDateOfRecurringDatesDaily.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php index 73f912b..45a1ad0 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsSingleConfigurationTest.php @@ -2,20 +2,20 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; +use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox Import of configuration - */ -class ImportsSingleConfigurationTest extends AbstractTest +#[TestDox('Import of configuration')] +class ImportsSingleConfigurationTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsConfiguration(): void { - $this->setDateAspect(new \DateTimeImmutable('2021-07-13', new \DateTimeZone('Europe/Berlin'))); + $this->setDateAspect(new DateTimeImmutable('2021-07-13', new DateTimeZone('Europe/Berlin'))); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleRegion.php'); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleCategory.php'); @@ -56,7 +56,7 @@ public function importsConfiguration(): void $this->getAllRecords('tx_events_domain_model_region'), 'Added or removed unexpected region.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsExampleAsExpected.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsExampleAsExpected.php'); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php index 4b83a41..91d0ede 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsTicketsTest.php @@ -3,18 +3,17 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -class ImportsTicketsTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsTicketsTest extends AbstractTestCase { /** - * @test - * * @todo: Missing "ticket" example and combinations. * Could not find any "ticket" real world example. */ + #[Test] public function importsExampleAsExpected(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); @@ -40,7 +39,7 @@ public function importsExampleAsExpected(): void 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()); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsTickets.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsTickets.php'); $this->assertEmptyLog(); } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php index 499c77d..d29141f 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithConfiguredRepeatUntilTest.php @@ -2,24 +2,24 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; +use DateTimeImmutable; +use DateTimeZone; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -class ImportsWithConfiguredRepeatUntilTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsWithConfiguredRepeatUntilTest extends AbstractTestCase { public function setUp(): void { parent::setUp(); $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/MinimalImportConfiguration.php'); - $this->setDateAspect(new \DateTimeImmutable('2022-07-13', new \DateTimeZone('UTC'))); + $this->setDateAspect(new DateTimeImmutable('2022-07-13', new DateTimeZone('UTC'))); } - /** - * @test - */ + #[Test] public function recurringWeekly(): void { $this->setUpConfiguration([ @@ -31,13 +31,11 @@ public function recurringWeekly(): void $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsRecurringDatesWeeklyWithConfiguredRepeatUntil.php'); $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function recurringDaily(): void { $this->setUpConfiguration([ @@ -49,7 +47,7 @@ public function recurringDaily(): void $this->executeCommand(); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsRecurringDatesDailyWithConfiguredRepeatUntil.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php index 10cdcb7..794ac20 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithLocationsTest.php @@ -3,11 +3,11 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -final class ImportsWithLocationsTest extends AbstractTest +#[TestDox('DestinationData import')] +final class ImportsWithLocationsTest extends AbstractTestCase { protected function setUp(): void { @@ -24,9 +24,7 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function importsWithLocations(): void { $this->setUpResponses([ @@ -42,9 +40,8 @@ public function importsWithLocations(): void /** * A single location might be available with different ways to write latitude an longitude ("," and "."). * This test ensures this situation is properly handled by streamlining the values. - * - * @test */ + #[Test] public function importsWithSingleLocationOnDuplicates(): void { $this->setUpResponses([ @@ -57,9 +54,7 @@ public function importsWithSingleLocationOnDuplicates(): void $this->assertEmptyLog(); } - /** - * @test - */ + #[Test] public function updatesExistingLocation(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/ExistingLocation.php'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php index bc9efe1..7a6f653 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutCategoryIfNotProvidedTest.php @@ -3,16 +3,14 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsWithoutCategoryIfNotProvidedTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsWithoutCategoryIfNotProvided(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); @@ -58,7 +56,7 @@ public function importsWithoutCategoryIfNotProvided(): void $this->getAllRecords('sys_category'), 'Added unexpected category.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutCategoryIfNotProvided.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsWithoutCategoryIfNotProvided.php'); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php index 73638bf..65a737c 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutLocationTest.php @@ -3,15 +3,13 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; -/** - * @testdox DestinationData import - */ -class ImportsWithoutLocationTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsWithoutLocationTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsWithoutLocationIfNotProvided(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); @@ -35,7 +33,7 @@ public function importsWithoutLocationIfNotProvided(): void $this->getAllRecords('tx_events_domain_model_location'), 'Added unexpected location.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutLocationIfNotProvided.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsWithoutLocationIfNotProvided.php'); $this->assertEmptyLog(); } } diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php index 884df38..afc9cdc 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsWithoutRegionIfNotProvidedTest.php @@ -3,16 +3,14 @@ namespace WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * @testdox DestinationData import - */ -class ImportsWithoutRegionIfNotProvidedTest extends AbstractTest +#[TestDox('DestinationData import')] +class ImportsWithoutRegionIfNotProvidedTest extends AbstractTestCase { - /** - * @test - */ + #[Test] public function importsWithoutRegionIfNotProvided(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/SingleImportConfigurationWithoutRegion.php'); @@ -52,7 +50,7 @@ public function importsWithoutRegionIfNotProvided(): void $this->getAllRecords('tx_events_domain_model_region'), 'Added unexpected region.' ); - $this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithoutRegionIfNotProvided.csv'); + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsWithoutRegionIfNotProvided.php'); $importedFiles = GeneralUtility::getFilesInDir($this->fileImportPath); self::assertIsArray($importedFiles, 'Failed to retrieve imported files from filesystem.'); diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/Assertions/RegisteredEventHandlerCanModifyEvent.php b/Tests/Functional/Psr14Events/DestinationDataImport/Assertions/RegisteredEventHandlerCanModifyEvent.php index eb9a91c..8d09d25 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/Assertions/RegisteredEventHandlerCanModifyEvent.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/Assertions/RegisteredEventHandlerCanModifyEvent.php @@ -15,14 +15,14 @@ 'uid' => 1, 'pid' => 2, 'event' => 1, - 'start' => 4097728800, + 'start' => 4_097_728_800, 'end' => null, ], [ 'uid' => 2, 'pid' => 2, 'event' => 1, - 'start' => 4097815200, + 'start' => 4_097_815_200, 'end' => null, ], ], diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php b/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php index 0d3b1c3..7beea0e 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/CategoriesAssignEventTest.php @@ -24,9 +24,10 @@ namespace WerkraumMedia\Events\Tests\Functional\Psr14Events\DestinationDataImport; use GuzzleHttp\Psr7\Response; -use WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest\AbstractTest; +use PHPUnit\Framework\Attributes\Test; +use WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest\AbstractTestCase; -final class CategoriesAssignEventTest extends AbstractTest +final class CategoriesAssignEventTest extends AbstractTestCase { protected function setUp(): void { @@ -44,9 +45,7 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function registeredEventHandlerCanKeepCustomCategoriesAssigned(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/RegisteredEventHandlerCanKeepCustomCategoriesAssigned.php'); diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php b/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php index fce958a..cbce582 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/EventImportEventTest.php @@ -24,9 +24,10 @@ namespace WerkraumMedia\Events\Tests\Functional\Psr14Events\DestinationDataImport; use GuzzleHttp\Psr7\Response; -use WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest\AbstractTest; +use PHPUnit\Framework\Attributes\Test; +use WerkraumMedia\Events\Tests\Functional\Import\DestinationDataTest\AbstractTestCase; -final class EventImportEventTest extends AbstractTest +final class EventImportEventTest extends AbstractTestCase { protected function setUp(): void { @@ -44,9 +45,7 @@ protected function setUp(): void ]); } - /** - * @test - */ + #[Test] public function registeredEventHandlerCanModifyEvent(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/RegisteredEventHandlerCanModifyEvent.php'); diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_categories/ext_emconf.php b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_categories/ext_emconf.php index 3a15f40..48e06cd 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_categories/ext_emconf.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_categories/ext_emconf.php @@ -7,12 +7,10 @@ 'author' => 'Daniel Siepmann', 'author_email' => 'coding@daniel-siepmann.de', 'state' => 'alpha', - 'createDirs' => '', - 'clearCacheOnLoad' => 0, 'version' => '1.0.0', 'constraints' => [ 'depends' => [ - 'event' => '', + 'events' => '', ], 'conflicts' => [], 'suggests' => [], diff --git a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_event/ext_emconf.php b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_event/ext_emconf.php index a7b43b2..6e7725e 100644 --- a/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_event/ext_emconf.php +++ b/Tests/Functional/Psr14Events/DestinationDataImport/Fixtures/Extensions/custom_event/ext_emconf.php @@ -7,12 +7,10 @@ 'author' => 'Daniel Siepmann', 'author_email' => 'coding@daniel-siepmann.de', 'state' => 'alpha', - 'createDirs' => '', - 'clearCacheOnLoad' => 0, 'version' => '1.0.0', 'constraints' => [ 'depends' => [ - 'event' => '', + 'events' => '', ], 'conflicts' => [], 'suggests' => [], diff --git a/Tests/Functional/Updates/MigrateDuplicateLocationsTest.php b/Tests/Functional/Updates/MigrateDuplicateLocationsTest.php index 218d28b..bf3fee2 100644 --- a/Tests/Functional/Updates/MigrateDuplicateLocationsTest.php +++ b/Tests/Functional/Updates/MigrateDuplicateLocationsTest.php @@ -23,17 +23,15 @@ namespace WerkraumMedia\Events\Tests\Functional\Updates; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; use WerkraumMedia\Events\Tests\Functional\AbstractFunctionalTestCase; use WerkraumMedia\Events\Updates\MigrateDuplicateLocations; -/** - * @testdox The update wizard to migrate duplicate locations - */ +#[TestDox('The update wizard to migrate duplicate locations')] final class MigrateDuplicateLocationsTest extends AbstractFunctionalTestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = $this->get(MigrateDuplicateLocations::class); @@ -41,20 +39,7 @@ public function canBeCreated(): void self::assertInstanceOf(MigrateDuplicateLocations::class, $subject); } - /** - * @test - */ - public function isRegistered(): void - { - self::assertArrayHasKey( - MigrateDuplicateLocations::class, - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] - ); - } - - /** - * @test - */ + #[Test] public function keepsDataIfNothingToDo(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/MigrateDuplicateLocationsNoDuplicates.php'); @@ -67,9 +52,7 @@ public function keepsDataIfNothingToDo(): void $this->assertPHPDataSet(__DIR__ . '/Fixtures/MigrateDuplicateLocationsNoDuplicates.php'); } - /** - * @test - */ + #[Test] public function migratesDuplicateEntries(): void { $this->importPHPDataSet(__DIR__ . '/Fixtures/MigrateDuplicateLocations.php'); diff --git a/Tests/ProphecyTrait.php b/Tests/ProphecyTrait.php deleted file mode 100644 index 76dbf04..0000000 --- a/Tests/ProphecyTrait.php +++ /dev/null @@ -1,18 +0,0 @@ -getSorting()); } - /** - * @test - */ + #[Test] public function canBeVisible(): void { $subject = new Category( @@ -61,9 +55,7 @@ public function canBeVisible(): void self::assertFalse($subject->_getProperty('hidden')); } - /** - * @test - */ + #[Test] public function canHide(): void { $subject = new Category( diff --git a/Tests/Unit/Domain/Model/DateTest.php b/Tests/Unit/Domain/Model/DateTest.php index 8ad1cf7..212a865 100644 --- a/Tests/Unit/Domain/Model/DateTest.php +++ b/Tests/Unit/Domain/Model/DateTest.php @@ -2,17 +2,16 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model; +use DateTime; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use WerkraumMedia\Events\Domain\Model\Date; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Date - */ +#[CoversClass(Date::class)] class DateTest extends TestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new Date(); @@ -23,53 +22,43 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function returnsThatItHasUsefulStartTime(): void { $subject = new Date(); - $subject->setStart(new \DateTime('2022-07-11T13:48:00')); + $subject->setStart(new DateTime('2022-07-11T13:48:00')); self::assertTrue($subject->getHasUsefulStartTime()); } - /** - * @test - */ + #[Test] public function returnsThatItDoesNotHaveUsefulStartTime(): void { $subject = new Date(); - $subject->setStart(new \DateTime('2022-07-11T00:00:00')); + $subject->setStart(new DateTime('2022-07-11T00:00:00')); self::assertFalse($subject->getHasUsefulStartTime()); } - /** - * @test - */ + #[Test] public function returnsThatItHasUsefulEndTime(): void { $subject = new Date(); - $subject->setEnd(new \DateTime('2022-07-11T00:00:00')); + $subject->setEnd(new DateTime('2022-07-11T00:00:00')); self::assertTrue($subject->getHasUsefulEndTime()); } - /** - * @test - */ + #[Test] public function returnsThatItDoesNotHaveUsefulEndTimeWithTime(): void { $subject = new Date(); - $subject->setEnd(new \DateTime('2022-07-11T23:59:00')); + $subject->setEnd(new DateTime('2022-07-11T23:59:00')); self::assertFalse($subject->getHasUsefulEndTime()); } - /** - * @test - */ + #[Test] public function returnsThatItDoesNotHaveUsefulEndTimeWithNull(): void { $subject = new Date(); @@ -78,45 +67,37 @@ public function returnsThatItDoesNotHaveUsefulEndTimeWithNull(): void self::assertFalse($subject->getHasUsefulEndTime()); } - /** - * @test - */ + #[Test] public function returnsThatItEndsOnSameDay(): void { $subject = new Date(); - $subject->setStart(new \DateTime('2022-07-11T14:00:00')); - $subject->setEnd(new \DateTime('2022-07-11T22:00:00')); + $subject->setStart(new DateTime('2022-07-11T14:00:00')); + $subject->setEnd(new DateTime('2022-07-11T22:00:00')); self::assertTrue($subject->getEndsOnSameDay()); } - /** - * @test - */ + #[Test] public function returnsThatItDoesNotEndOnSameDayWithDifferentDates(): void { $subject = new Date(); - $subject->setStart(new \DateTime('2022-07-11T14:00:00')); - $subject->setEnd(new \DateTime('2022-07-13T22:00:00')); + $subject->setStart(new DateTime('2022-07-11T14:00:00')); + $subject->setEnd(new DateTime('2022-07-13T22:00:00')); self::assertFalse($subject->getEndsOnSameDay()); } - /** - * @test - */ + #[Test] public function returnsThatItDoesNotEndOnSameDayWithMissingEnd(): void { $subject = new Date(); - $subject->setStart(new \DateTime('2022-07-11T14:00:00')); + $subject->setStart(new DateTime('2022-07-11T14:00:00')); $subject->setEnd(null); self::assertFalse($subject->getEndsOnSameDay()); } - /** - * @test - */ + #[Test] public function returnsNullAsEnd(): void { $subject = new Date(); @@ -125,12 +106,10 @@ public function returnsNullAsEnd(): void self::assertNull($subject->getEnd()); } - /** - * @test - */ + #[Test] public function returnsEnd(): void { - $end = new \DateTime('2022-07-13T22:00:00'); + $end = new DateTime('2022-07-13T22:00:00'); $subject = new Date(); $subject->setEnd($end); diff --git a/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php b/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php index c0f7819..efae7e7 100644 --- a/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php +++ b/Tests/Unit/Domain/Model/Dto/DateDemandFactoryTest.php @@ -23,19 +23,20 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model\Dto; +use DateTimeImmutable; +use Generator; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Core\TypoScript\TypoScriptService; use WerkraumMedia\Events\Domain\Model\Dto\DateDemand; use WerkraumMedia\Events\Domain\Model\Dto\DateDemandFactory; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Dto\DateDemandFactory - */ +#[CoversClass(DateDemandFactory::class)] class DateDemandFactoryTest extends TestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -50,9 +51,7 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function fromSettingsDoesNotThrowUndefinedArrayKeyWarnings(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -69,9 +68,7 @@ public function fromSettingsDoesNotThrowUndefinedArrayKeyWarnings(): void ); } - /** - * @test - */ + #[Test] public function searchWordIsSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -93,9 +90,7 @@ public function searchWordIsSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function synonymsAreSetBySettings(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -134,9 +129,7 @@ public function synonymsAreSetBySettings(): void ); } - /** - * @test - */ + #[Test] public function categoriesAreSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -163,9 +156,7 @@ public function categoriesAreSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function featuresAreSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -192,9 +183,7 @@ public function featuresAreSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function regionIsSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -222,9 +211,7 @@ public function regionIsSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function regionsAreSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -255,9 +242,7 @@ public function regionsAreSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function startIsSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -274,7 +259,7 @@ public function startIsSetByRequest(): void ); self::assertInstanceOf( - \DateTimeImmutable::class, + DateTimeImmutable::class, $result->getStartObject() ); self::assertSame( @@ -287,9 +272,7 @@ public function startIsSetByRequest(): void ); } - /** - * @test - */ + #[Test] public function endIsSetByRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -306,7 +289,7 @@ public function endIsSetByRequest(): void ); self::assertInstanceOf( - \DateTimeImmutable::class, + DateTimeImmutable::class, $result->getEndObject() ); self::assertSame( @@ -319,11 +302,8 @@ public function endIsSetByRequest(): void ); } - /** - * @test - * - * @dataProvider possibleEndAndStartNullCombinations - */ + #[DataProvider('possibleEndAndStartNullCombinations')] + #[Test] public function returnsEndsOnSameDayIfAnyIsNull( string $start, string $end @@ -347,7 +327,7 @@ public function returnsEndsOnSameDayIfAnyIsNull( ); } - public function possibleEndAndStartNullCombinations(): \Generator + public static function possibleEndAndStartNullCombinations(): Generator { yield 'Both are empty' => [ 'start' => '', @@ -363,9 +343,7 @@ public function possibleEndAndStartNullCombinations(): \Generator ]; } - /** - * @test - */ + #[Test] public function returnsEndsOnSameDayIfBothAreOnSameDay(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -387,9 +365,7 @@ public function returnsEndsOnSameDayIfBothAreOnSameDay(): void ); } - /** - * @test - */ + #[Test] public function returnsEndsOnSameDayIfBothAreOnDifferentDays(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -411,14 +387,9 @@ public function returnsEndsOnSameDayIfBothAreOnDifferentDays(): void ); } - /** - * @test - * - * @dataProvider possibleSubmittedHighlights - * - * @param mixed $highlight - */ - public function returnsHighlightIfSet($highlight): void + #[DataProvider('possibleSubmittedHighlights')] + #[Test] + public function returnsHighlightIfSet(mixed $highlight): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -436,21 +407,16 @@ public function returnsHighlightIfSet($highlight): void self::assertTrue($result->getHighlight()); } - public function possibleSubmittedHighlights(): \Generator + public static function possibleSubmittedHighlights(): Generator { yield 'true' => ['highlight' => true]; yield '1 as integer' => ['highlight' => 1]; yield '1 as string' => ['highlight' => '1']; } - /** - * @test - * - * @dataProvider possibleSubmittedFalsyHighlights - * - * @param mixed $highlight - */ - public function returnsNoHighlightIfNotSet($highlight): void + #[DataProvider('possibleSubmittedFalsyHighlights')] + #[Test] + public function returnsNoHighlightIfNotSet(mixed $highlight): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -468,7 +434,7 @@ public function returnsNoHighlightIfNotSet($highlight): void self::assertFalse($result->getHighlight()); } - public function possibleSubmittedFalsyHighlights(): \Generator + public static function possibleSubmittedFalsyHighlights(): Generator { yield 'false' => ['highlight' => false]; yield '0 as integer' => ['highlight' => 0]; @@ -476,9 +442,7 @@ public function possibleSubmittedFalsyHighlights(): \Generator yield 'empty string' => ['highlight' => '']; } - /** - * @test - */ + #[Test] public function returnsOrganizersFromSettings(): void { $typoScriptService = $this->createStub(TypoScriptService::class); @@ -493,9 +457,7 @@ public function returnsOrganizersFromSettings(): void self::assertSame([10, 0, 2], $result->getOrganizers()); } - /** - * @test - */ + #[Test] public function returnsOrganizersFromRequest(): void { $typoScriptService = $this->createStub(TypoScriptService::class); diff --git a/Tests/Unit/Domain/Model/Dto/EventDemandFactoryTest.php b/Tests/Unit/Domain/Model/Dto/EventDemandFactoryTest.php index f656f2e..c127df5 100644 --- a/Tests/Unit/Domain/Model/Dto/EventDemandFactoryTest.php +++ b/Tests/Unit/Domain/Model/Dto/EventDemandFactoryTest.php @@ -23,18 +23,16 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model\Dto; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use WerkraumMedia\Events\Domain\Model\Dto\EventDemand; use WerkraumMedia\Events\Domain\Model\Dto\EventDemandFactory; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Dto\EventDemandFactory - */ +#[CoversClass(EventDemandFactory::class)] class EventDemandFactoryTest extends TestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new EventDemandFactory(); @@ -45,9 +43,7 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function fromSettingsDoesNotThrowUndefinedArrayKeyWarnings(): void { $subject = new EventDemandFactory(); diff --git a/Tests/Unit/Domain/Model/EventTest.php b/Tests/Unit/Domain/Model/EventTest.php index e2551f1..d6dff52 100644 --- a/Tests/Unit/Domain/Model/EventTest.php +++ b/Tests/Unit/Domain/Model/EventTest.php @@ -4,19 +4,17 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use WerkraumMedia\Events\Domain\Model\Category; use WerkraumMedia\Events\Domain\Model\Event; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Event - */ +#[CoversClass(Event::class)] class EventTest extends TestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new Event(); @@ -27,9 +25,7 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function returnsSortedFeatures(): void { $feature1 = $this->createStub(Category::class); @@ -50,9 +46,7 @@ public function returnsSortedFeatures(): void ], $subject->getFeatures()); } - /** - * @test - */ + #[Test] public function returnsEmptyFeaturesStorage(): void { $subject = new Event(); diff --git a/Tests/Unit/Domain/Model/ImportTest.php b/Tests/Unit/Domain/Model/ImportTest.php index 65ebd38..b0d974a 100644 --- a/Tests/Unit/Domain/Model/ImportTest.php +++ b/Tests/Unit/Domain/Model/ImportTest.php @@ -2,29 +2,24 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Core\Resource\Folder; use WerkraumMedia\Events\Domain\Model\Category; use WerkraumMedia\Events\Domain\Model\Import; use WerkraumMedia\Events\Domain\Model\Region; -use WerkraumMedia\Events\Tests\ProphecyTrait; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Import - */ +#[CoversClass(Import::class)] class ImportTest extends TestCase { - use ProphecyTrait; - - /** - * @test - */ + #[Test] public function canBeCreated(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '' ); @@ -35,15 +30,13 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function returnsRestExperience(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, 'experience' ); @@ -54,15 +47,13 @@ public function returnsRestExperience(): void ); } - /** - * @test - */ + #[Test] public function returnsStoragePid(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 20, '' ); @@ -73,16 +64,14 @@ public function returnsStoragePid(): void ); } - /** - * @test - */ + #[Test] public function returnsRegion(): void { - $folder = $this->prophesize(Folder::class); - $region = $this->prophesize(Region::class); + $folder = $this->createStub(Folder::class); + $region = $this->createStub(Region::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', '', @@ -90,43 +79,39 @@ public function returnsRegion(): void null, 0, null, - $region->reveal() + $region ); self::assertSame( - $region->reveal(), + $region, $subject->getRegion() ); } - /** - * @test - */ + #[Test] public function returnsFilesFolder(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '' ); self::assertSame( - $folder->reveal(), + $folder, $subject->getFilesFolder() ); } - /** - * @test - */ + #[Test] public function returnsCategoriesPid(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', '', @@ -139,38 +124,34 @@ public function returnsCategoriesPid(): void ); } - /** - * @test - */ + #[Test] public function returnsCategoryParent(): void { - $category = $this->prophesize(Category::class); - $folder = $this->prophesize(Folder::class); + $category = $this->createStub(Category::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', '', 0, - $category->reveal() + $category ); self::assertSame( - $category->reveal(), + $category, $subject->getCategoryParent() ); } - /** - * @test - */ + #[Test] public function returnsFeaturesPid(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', '', @@ -185,40 +166,36 @@ public function returnsFeaturesPid(): void ); } - /** - * @test - */ + #[Test] public function returnsFeaturesParent(): void { - $feature = $this->prophesize(Category::class); - $folder = $this->prophesize(Folder::class); + $feature = $this->createStub(Category::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', '', 0, null, 0, - $feature->reveal() + $feature ); self::assertSame( - $feature->reveal(), + $feature, $subject->getFeaturesParent() ); } - /** - * @test - */ + #[Test] public function returnsSearchQuery(): void { - $folder = $this->prophesize(Folder::class); + $folder = $this->createStub(Folder::class); $subject = new Import( - $folder->reveal(), + $folder, 0, '', 'name:"Test"' diff --git a/Tests/Unit/Domain/Model/LocationTest.php b/Tests/Unit/Domain/Model/LocationTest.php index ef16da8..da6664b 100644 --- a/Tests/Unit/Domain/Model/LocationTest.php +++ b/Tests/Unit/Domain/Model/LocationTest.php @@ -23,19 +23,17 @@ namespace WerkraumMedia\Events\Tests\Unit\Domain\Model; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use WerkraumMedia\Events\Domain\Model\Location; -/** - * @covers \WerkraumMedia\Events\Domain\Model\Location - */ +#[CoversClass(Location::class)] final class LocationTest extends TestCase { - /** - * @test - * - * @dataProvider possibleLatitudeAndLongitude - */ + #[DataProvider('possibleLatitudeAndLongitude')] + #[Test] public function normalizesLatitudeAndLongitude( string $latitude, string $longitude diff --git a/Tests/Unit/Events/Controller/DateListVariablesTest.php b/Tests/Unit/Events/Controller/DateListVariablesTest.php index ec49ba0..5a7ff24 100644 --- a/Tests/Unit/Events/Controller/DateListVariablesTest.php +++ b/Tests/Unit/Events/Controller/DateListVariablesTest.php @@ -4,30 +4,25 @@ namespace WerkraumMedia\Tests\Unit\Events\Controller; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Core\Pagination\PaginationInterface; use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult; use WerkraumMedia\Events\Domain\Model\Dto\DateDemand; use WerkraumMedia\Events\Events\Controller\DateListVariables; -use WerkraumMedia\Events\Tests\ProphecyTrait; -/** - * @covers \WerkraumMedia\Events\Events\Controller\DateListVariables - */ +#[CoversClass(DateListVariables::class)] class DateListVariablesTest extends TestCase { - use ProphecyTrait; - - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new DateListVariables( [], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), - $this->prophesize(PaginationInterface::class)->reveal() + $this->createStub(QueryResult::class), + $this->createStub(PaginationInterface::class) ); self::assertInstanceOf( @@ -36,9 +31,7 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialSearch(): void { $subject = new DateListVariables( @@ -46,8 +39,8 @@ public function returnsInitialSearch(): void 'executed' => '1', ], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), - $this->prophesize(PaginationInterface::class)->reveal() + $this->createStub(QueryResult::class), + $this->createStub(PaginationInterface::class) ); self::assertSame( @@ -58,9 +51,7 @@ public function returnsInitialSearch(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialDemand(): void { $demand = new DateDemand(); @@ -68,8 +59,8 @@ public function returnsInitialDemand(): void [ ], $demand, - $this->prophesize(QueryResult::class)->reveal(), - $this->prophesize(PaginationInterface::class)->reveal() + $this->createStub(QueryResult::class), + $this->createStub(PaginationInterface::class) ); self::assertSame( @@ -78,18 +69,16 @@ public function returnsInitialDemand(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialDates(): void { - $dates = $this->prophesize(QueryResult::class)->reveal(); + $dates = $this->createStub(QueryResult::class); $subject = new DateListVariables( [ ], new DateDemand(), $dates, - $this->prophesize(PaginationInterface::class)->reveal() + $this->createStub(PaginationInterface::class) ); self::assertSame( @@ -98,14 +87,12 @@ public function returnsInitialDates(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialVariablesForView(): void { $demand = new DateDemand(); - $dates = $this->prophesize(QueryResult::class)->reveal(); - $pagination = $this->prophesize(PaginationInterface::class)->reveal(); + $dates = $this->createStub(QueryResult::class); + $pagination = $this->createStub(PaginationInterface::class); $subject = new DateListVariables( [ 'executed' => '1', @@ -128,14 +115,12 @@ public function returnsInitialVariablesForView(): void ); } - /** - * @test - */ + #[Test] public function returnsVariablesForViewWithAddedVariables(): void { $demand = new DateDemand(); - $dates = $this->prophesize(QueryResult::class)->reveal(); - $pagination = $this->prophesize(PaginationInterface::class)->reveal(); + $dates = $this->createStub(QueryResult::class); + $pagination = $this->createStub(PaginationInterface::class); $subject = new DateListVariables( [ 'executed' => '1', @@ -163,14 +148,12 @@ public function returnsVariablesForViewWithAddedVariables(): void ); } - /** - * @test - */ + #[Test] public function returnsVariablesForViewWithOverwrittenVariables(): void { $demand = new DateDemand(); - $dates = $this->prophesize(QueryResult::class)->reveal(); - $pagination = $this->prophesize(PaginationInterface::class)->reveal(); + $dates = $this->createStub(QueryResult::class); + $pagination = $this->createStub(PaginationInterface::class); $subject = new DateListVariables( [ 'executed' => '1', diff --git a/Tests/Unit/Events/Controller/DateSearchVariablesTest.php b/Tests/Unit/Events/Controller/DateSearchVariablesTest.php index b375a71..0bf5399 100644 --- a/Tests/Unit/Events/Controller/DateSearchVariablesTest.php +++ b/Tests/Unit/Events/Controller/DateSearchVariablesTest.php @@ -4,29 +4,24 @@ namespace WerkraumMedia\Events\Tests\Unit\Events\Controller; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult; use WerkraumMedia\Events\Domain\Model\Dto\DateDemand; use WerkraumMedia\Events\Events\Controller\DateSearchVariables; -use WerkraumMedia\Events\Tests\ProphecyTrait; -/** - * @covers \WerkraumMedia\Events\Events\Controller\DateSearchVariables - */ +#[CoversClass(DateSearchVariables::class)] class DateSearchVariablesTest extends TestCase { - use ProphecyTrait; - - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new DateSearchVariables( [ ], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), + $this->createStub(QueryResult::class), [], [] ); @@ -37,9 +32,7 @@ public function canBeCreated(): void ); } - /** - * @test - */ + #[Test] public function returnsInitializeSearch(): void { $subject = new DateSearchVariables( @@ -47,7 +40,7 @@ public function returnsInitializeSearch(): void 'executed' => '1', ], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), + $this->createStub(QueryResult::class), [], [] ); @@ -60,9 +53,7 @@ public function returnsInitializeSearch(): void ); } - /** - * @test - */ + #[Test] public function returnsInitializeDemand(): void { $demand = new DateDemand(); @@ -70,7 +61,7 @@ public function returnsInitializeDemand(): void [ ], $demand, - $this->prophesize(QueryResult::class)->reveal(), + $this->createStub(QueryResult::class), [], [] ); @@ -81,12 +72,10 @@ public function returnsInitializeDemand(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialRegions(): void { - $regions = $this->prophesize(QueryResult::class)->reveal(); + $regions = $this->createStub(QueryResult::class); $subject = new DateSearchVariables( [ ], @@ -102,16 +91,14 @@ public function returnsInitialRegions(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialCategories(): void { $subject = new DateSearchVariables( [ ], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), + $this->createStub(QueryResult::class), [ ['example category'], ], @@ -126,16 +113,14 @@ public function returnsInitialCategories(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialFeatures(): void { $subject = new DateSearchVariables( [ ], new DateDemand(), - $this->prophesize(QueryResult::class)->reveal(), + $this->createStub(QueryResult::class), [ ], [ @@ -151,13 +136,11 @@ public function returnsInitialFeatures(): void ); } - /** - * @test - */ + #[Test] public function returnsInitialVariablesForView(): void { $demand = new DateDemand(); - $regions = $this->prophesize(QueryResult::class)->reveal(); + $regions = $this->createStub(QueryResult::class); $subject = new DateSearchVariables( [ 'executed' => '1', @@ -190,13 +173,11 @@ public function returnsInitialVariablesForView(): void ); } - /** - * @test - */ + #[Test] public function returnsVariablesForViewWithAddedVariables(): void { $demand = new DateDemand(); - $regions = $this->prophesize(QueryResult::class)->reveal(); + $regions = $this->createStub(QueryResult::class); $subject = new DateSearchVariables( [ 'executed' => '1', @@ -234,13 +215,11 @@ public function returnsVariablesForViewWithAddedVariables(): void ); } - /** - * @test - */ + #[Test] public function returnsVariablesForViewWithOverwrittenVariables(): void { $demand = new DateDemand(); - $regions = $this->prophesize(QueryResult::class)->reveal(); + $regions = $this->createStub(QueryResult::class); $subject = new DateSearchVariables( [ 'executed' => '1', diff --git a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php index f2998a0..c083a27 100644 --- a/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/DatesFactoryTest.php @@ -4,6 +4,11 @@ namespace WerkraumMedia\Events\Tests\Unit\Service\DestinationDataImportService; +use DateTimeImmutable; +use Generator; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\DateTimeAspect; @@ -13,9 +18,7 @@ use WerkraumMedia\Events\Domain\Model\Date; use WerkraumMedia\Events\Service\DestinationDataImportService\DatesFactory; -/** - * @covers \WerkraumMedia\Events\Service\DestinationDataImportService\DatesFactory - */ +#[CoversClass(DatesFactory::class)] class DatesFactoryTest extends TestCase { private function createTestSubject( @@ -26,14 +29,13 @@ private function createTestSubject( $logManager->method('getLogger')->willReturn($logger); return new DatesFactory( - $this->createContext(new \DateTimeImmutable($contextDate)), + $this->createContext(new DateTimeImmutable($contextDate)), $this->createStub(ConfigurationManager::class), $logManager ); } - /** - * @test - */ + + #[Test] public function canBeCreated(): void { $subject = $this->createTestSubject('now'); @@ -44,22 +46,19 @@ public function canBeCreated(): void ); } - /** - * @test - * - * @dataProvider possibleUnkownInput - */ + #[DataProvider('possibleUnkownInput')] + #[Test] public function returnsNoResultOnUnkownInput(array $unkownInput): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); $result = $subject->createDates($unkownInput, false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); self::assertCount(0, iterator_to_array($result)); } - public function possibleUnkownInput(): array + public static function possibleUnkownInput(): array { return [ 'Empty Intervals' => [ @@ -74,9 +73,7 @@ public function possibleUnkownInput(): array ]; } - /** - * @test - */ + #[Test] public function returnsSingleNotCanceledDate(): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); @@ -88,7 +85,7 @@ public function returnsSingleNotCanceledDate(): void 'interval' => 1, ]], false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $firstEntry = $result->current(); @@ -100,9 +97,7 @@ public function returnsSingleNotCanceledDate(): void self::assertSame('no', $firstEntry->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsWeeklyWithConfiguredRepeat(): void { $subject = $this->createTestSubject('2023-01-01T13:17:24 Europe/Berlin'); @@ -119,15 +114,13 @@ public function returnsWeeklyWithConfiguredRepeat(): void 'interval' => 1, ]], false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(16, $result); } - /** - * @test - */ + #[Test] public function returnsSingleCanceledDate(): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); @@ -139,7 +132,7 @@ public function returnsSingleCanceledDate(): void 'interval' => 1, ]], true); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $firstEntry = $result->current(); @@ -151,9 +144,7 @@ public function returnsSingleCanceledDate(): void self::assertSame('canceled', $firstEntry->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsCanceledDatesOnDailyBasis(): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); @@ -167,7 +158,7 @@ public function returnsCanceledDatesOnDailyBasis(): void 'interval' => 1, ]], true); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(5, $result); @@ -182,9 +173,7 @@ public function returnsCanceledDatesOnDailyBasis(): void self::assertSame('canceled', $result[4]->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsNotCanceledDatesOnDailyBasis(): void { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); @@ -198,7 +187,7 @@ public function returnsNotCanceledDatesOnDailyBasis(): void 'interval' => 1, ]], false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(5, $result); @@ -213,9 +202,7 @@ public function returnsNotCanceledDatesOnDailyBasis(): void self::assertSame('no', $result[4]->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsCanceledDatesOnWeeklyBasis(): void { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); @@ -233,7 +220,7 @@ public function returnsCanceledDatesOnWeeklyBasis(): void 'interval' => 1, ]], true); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(4, $result); @@ -256,9 +243,7 @@ public function returnsCanceledDatesOnWeeklyBasis(): void self::assertSame('canceled', $result[3]->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsNotCanceledDatesOnWeeklyBasis(): void { $subject = $this->createTestSubject('2022-08-29T13:17:24 Europe/Berlin'); @@ -276,7 +261,7 @@ public function returnsNotCanceledDatesOnWeeklyBasis(): void 'interval' => 1, ]], false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(4, $result); @@ -299,9 +284,7 @@ public function returnsNotCanceledDatesOnWeeklyBasis(): void self::assertSame('no', $result[3]->getCanceled()); } - /** - * @test - */ + #[Test] public function returnsCanceledDatesOnMixedIntervals(): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); @@ -335,7 +318,7 @@ public function returnsCanceledDatesOnMixedIntervals(): void ], ], true); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(8, $result); @@ -346,9 +329,7 @@ public function returnsCanceledDatesOnMixedIntervals(): void } } - /** - * @test - */ + #[Test] public function returnsNotCanceledDatesOnMixedIntervals(): void { $subject = $this->createTestSubject('2022-01-01T13:17:24 Europe/Berlin'); @@ -382,7 +363,7 @@ public function returnsNotCanceledDatesOnMixedIntervals(): void ], ], false); - self::assertInstanceOf(\Generator::class, $result); + self::assertInstanceOf(Generator::class, $result); $result = iterator_to_array($result); self::assertCount(8, $result); @@ -393,7 +374,7 @@ public function returnsNotCanceledDatesOnMixedIntervals(): void } } - private function createContext(\DateTimeImmutable $dateTime): Context + private function createContext(DateTimeImmutable $dateTime): Context { $context = new Context(); $context->setAspect('date', new DateTimeAspect($dateTime)); diff --git a/Tests/Unit/Service/DestinationDataImportService/LocationAssignmentTest.php b/Tests/Unit/Service/DestinationDataImportService/LocationAssignmentTest.php index a2faff0..b6ab686 100644 --- a/Tests/Unit/Service/DestinationDataImportService/LocationAssignmentTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/LocationAssignmentTest.php @@ -23,19 +23,18 @@ namespace WerkraumMedia\Events\Tests\Unit\Service\DestinationDataImportService; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use WerkraumMedia\Events\Domain\Model\Location; use WerkraumMedia\Events\Domain\Repository\LocationRepository; use WerkraumMedia\Events\Service\DestinationDataImportService\LocationAssignment; -/** - * @covers \WerkraumMedia\Events\Service\DestinationDataImportService\LocationAssignment - */ +#[CoversClass(LocationAssignment::class)] final class LocationAssignmentTest extends TestCase { - /** - * @test - */ + #[Test] public function canBeCreated(): void { $repository = $this->createStub(LocationRepository::class); @@ -50,13 +49,11 @@ public function canBeCreated(): void } /** - * @test - * - * @dataProvider possibleLatitudeAndLongitude - * * @param string|float $latitude * @param string|float $longitude */ + #[DataProvider('possibleLatitudeAndLongitude')] + #[Test] public function normalizesLatitudeAndLongitude( $latitude, $longitude diff --git a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php index d75eac7..151fde3 100644 --- a/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php +++ b/Tests/Unit/Service/DestinationDataImportService/UrlFactoryTest.php @@ -2,35 +2,26 @@ namespace WerkraumMedia\Events\Tests\Unit\Service\DestinationDataImportService; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\ObjectProphecy; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager; use WerkraumMedia\Events\Domain\Model\Import; use WerkraumMedia\Events\Service\DestinationDataImportService\UrlFactory; -use WerkraumMedia\Events\Tests\ProphecyTrait; -/** - * @covers \WerkraumMedia\Events\Service\DestinationDataImportService\UrlFactory - */ +#[CoversClass(UrlFactory::class)] class UrlFactoryTest extends TestCase { - use ProphecyTrait; - - /** - * @test - */ + #[Test] public function canBeCreated(): void { - $configurationManager = $this->prophesize(ConfigurationManager::class); - $configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, - 'Events', - 'Pi1' - )->willReturn([]); + $configurationManager = $this->createStub(BackendConfigurationManager::class); + $configurationManager->method('getConfiguration')->willReturn([]); $subject = new UrlFactory( - $configurationManager->reveal() + $configurationManager ); self::assertInstanceOf( @@ -39,28 +30,21 @@ public function canBeCreated(): void ); } - /** - * @test - * - * @dataProvider possibleImports - */ + #[DataProvider('possibleImports')] + #[Test] public function createSearchResultUrl( - ObjectProphecy $import, + Stub $import, array $settings, string $expectedResult ): void { - $configurationManager = $this->prophesize(ConfigurationManager::class); - $configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, - 'Events', - 'Pi1' - )->willReturn(['destinationData' => $settings]); + $configurationManager = $this->createStub(BackendConfigurationManager::class); + $configurationManager->method('getConfiguration')->willReturn(['settings' => ['destinationData' => $settings]]); $subject = new UrlFactory( - $configurationManager->reveal() + $configurationManager ); - $result = $subject->createSearchResultUrl($import->reveal()); + $result = $subject->createSearchResultUrl($import); self::assertSame( $result, @@ -68,14 +52,14 @@ public function createSearchResultUrl( ); } - public function possibleImports(): array + public static function possibleImports(): array { return [ 'All provided' => [ 'import' => (function () { - $import = $this->prophesize(Import::class); - $import->getRestExperience()->willReturn('experience'); - $import->getSearchQuery()->willReturn(''); + $import = self::createStub(Import::class); + $import->method('getRestExperience')->willReturn('experience'); + $import->method('getSearchQuery')->willReturn(''); return $import; })(), @@ -91,9 +75,9 @@ public function possibleImports(): array ], 'All missing' => [ 'import' => (function () { - $import = $this->prophesize(Import::class); - $import->getRestExperience()->willReturn(''); - $import->getSearchQuery()->willReturn(''); + $import = self::createStub(Import::class); + $import->method('getRestExperience')->willReturn(''); + $import->method('getSearchQuery')->willReturn(''); return $import; })(), @@ -104,9 +88,9 @@ public function possibleImports(): array ], 'Some missing' => [ 'import' => (function () { - $import = $this->prophesize(Import::class); - $import->getRestExperience()->willReturn('experience'); - $import->getSearchQuery()->willReturn(''); + $import = self::createStub(Import::class); + $import->method('getRestExperience')->willReturn('experience'); + $import->method('getSearchQuery')->willReturn(''); return $import; })(), @@ -120,9 +104,9 @@ public function possibleImports(): array ], 'With search query' => [ 'import' => (function () { - $import = $this->prophesize(Import::class); - $import->getRestExperience()->willReturn('experience'); - $import->getSearchQuery()->willReturn('name:"Test Something"'); + $import = self::createStub(Import::class); + $import->method('getRestExperience')->willReturn('experience'); + $import->method('getSearchQuery')->willReturn('name:"Test Something"'); return $import; })(), diff --git a/composer.json b/composer.json index e76906f..7ea4483 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,13 @@ } ], "require": { - "php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0", - "typo3/cms-core": "^10.4 || ^11.5", - "typo3/cms-extbase": "^10.4 || ^11.5", - "typo3/cms-filelist": "^10.4 || ^11.5", - "typo3/cms-filemetadata": "^10.4 || ^11.5", - "typo3/cms-fluid": "^10.4 || ^11.5", - "typo3/cms-frontend": "^10.4 || ^11.5" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "typo3/cms-core": "^12.4", + "typo3/cms-extbase": "^12.4", + "typo3/cms-filelist": "^12.4", + "typo3/cms-filemetadata": "^12.4", + "typo3/cms-fluid": "^12.4", + "typo3/cms-frontend": "^12.4" }, "autoload": { "psr-4": { @@ -46,33 +46,38 @@ ] }, "extra": { + "composer-exit-on-patch-failure": true, + "patches": { + "typo3/testing-framework": { + "Fix TypoScript record creation": "Patches/testing-framework-ts-record.patch", + "Fix Request state": "Patches/testing-framework-request-state.patch" + } + }, "typo3/cms": { - "cms-package-dir": "{$vendor-dir}/typo3/cms", "extension-key": "events", "web-dir": ".Build/web" } }, "require-dev": { - "codappix/typo3-php-datasets": "^1.2", - "friendsofphp/php-cs-fixer": "^3.4", + "codappix/typo3-php-datasets": "^1.4", + "cweagans/composer-patches": "^1.7", + "friendsofphp/php-cs-fixer": "^3.38", "guzzlehttp/guzzle": "^6.3 || ^7.3", - "jangregor/phpstan-prophecy": "1.0.0", - "phpspec/prophecy-phpunit": "^1.0 || ^2.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "1.10.28", - "phpstan/phpstan-phpunit": "1.1.1", - "saschaegerer/phpstan-typo3": "1.1.2", - "squizlabs/php_codesniffer": "^3.5", - "typo3/cms-backend": "^10.4 || ^11.5", - "typo3/cms-fluid-styled-content": "^10.4 || ^11.5", - "typo3/testing-framework": "^6.14" + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-phpunit": "1.3.15", + "saschaegerer/phpstan-typo3": "1.9.0", + "typo3/cms-backend": "^12.4", + "typo3/cms-fluid-styled-content": "^12.4", + "typo3/testing-framework": "^8.0" }, "config": { "sort-packages": true, "allow-plugins": { "typo3/class-alias-loader": true, "typo3/cms-composer-installers": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "cweagans/composer-patches": true } } } diff --git a/ext_emconf.php b/ext_emconf.php index 3379a7d..cdab464 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -7,8 +7,6 @@ 'author' => 'Dirk Koritnik, Daniel Siepmann', 'author_email' => 'koritnik@werkraum-media.de, coding@daniel-siepmann.de', 'state' => 'stable', - 'createDirs' => '', - 'clearCacheOnLoad' => 0, 'version' => '4.0.0', 'constraints' => [ 'depends' => [ diff --git a/ext_localconf.php b/ext_localconf.php index 49fe893..1a69177 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,33 +1,40 @@ 'search'], - [\WerkraumMedia\Events\Controller\DateController::class => 'search'] + [DateController::class => 'search'], + [DateController::class => 'search'] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Events', 'DateList', - [\WerkraumMedia\Events\Controller\DateController::class => 'list'], - [\WerkraumMedia\Events\Controller\DateController::class => 'list'] + [DateController::class => 'list'], + [DateController::class => 'list'] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Events', 'DateShow', - [\WerkraumMedia\Events\Controller\DateController::class => 'show'], - [\WerkraumMedia\Events\Controller\DateController::class => 'show'] + [DateController::class => 'show'], + [DateController::class => 'show'] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Events', 'Selected', - [\WerkraumMedia\Events\Controller\EventController::class => 'list'] + [EventController::class => 'list'] ); if ( @@ -39,19 +46,15 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = '^events_search'; - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); + $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); $iconRegistry->registerIcon( 'events-plugin', - \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + SvgIconProvider::class, ['source' => 'EXT:events/Resources/Public/Icons/Extension.svg'] ); $iconRegistry->registerIcon( 'pages-module-events', - \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + SvgIconProvider::class, ['source' => 'EXT:events/Resources/Public/Icons/Folder.svg'] ); - - \WerkraumMedia\Events\Caching\PageCacheTimeout::register(); - \WerkraumMedia\Events\Updates\MigrateOldLocations::register(); - \WerkraumMedia\Events\Updates\MigrateDuplicateLocations::register(); }); diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100644 index ac01726..0000000 --- a/ext_tables.php +++ /dev/null @@ -1,19 +0,0 @@ -\\|null\\) does not accept int\\.$#" count: 1 path: Classes/Domain/Model/Category.php - - message: "#^Parameter \\#1 \\$categories of method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Event\\:\\:setCategories\\(\\) expects TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\, TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\ given\\.$#" + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Date\\:\\:getLanguageUid\\(\\) should return int but returns int\\<\\-1, max\\>\\|null\\.$#" count: 1 - path: Classes/Service/DestinationDataImportService.php + path: Classes/Domain/Model/Date.php - - message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, 'strval' given\\.$#" + message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\AbstractDomainObject\\:\\:\\$_languageUid \\(int\\<\\-1, max\\>\\|null\\) does not accept int\\.$#" count: 1 - path: Classes/Domain/DestinationData/ImportFactory.php + path: Classes/Domain/Model/Date.php - - message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#" + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Event\\:\\:getLanguageUid\\(\\) should return int but returns int\\<\\-1, max\\>\\|null\\.$#" count: 1 - path: Classes/Domain/DestinationData/ImportFactory.php + path: Classes/Domain/Model/Event.php - - message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(TEntity, TEntity\\)\\: int, Closure\\(WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Category, WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Category\\)\\: int\\<\\-1, 1\\> given\\.$#" - count: 2 + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Event\\:\\:getLocalizedUid\\(\\) should return int but returns int\\<0, max\\>\\|null\\.$#" + count: 1 path: Classes/Domain/Model/Event.php - - message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Event\\:\\:getCategories\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(mixed, mixed\\)\\: int, Closure\\(WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Category, WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Category\\)\\: int\\<\\-1, 1\\> given\\.$#" count: 1 path: Classes/Domain/Model/Event.php - - message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Event\\:\\:getFeatures\\(\\) should return array\\ but returns array\\\\.$#" + message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\AbstractDomainObject\\:\\:\\$_languageUid \\(int\\<\\-1, max\\>\\|null\\) does not accept int\\.$#" count: 1 path: Classes/Domain/Model/Event.php - - message: "#^Call to method deleteFile\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Storage\\.$#" + message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\AbstractDomainObject\\:\\:\\$_languageUid \\(int\\<\\-1, max\\>\\|null\\) does not accept int\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Model/Location.php - - message: "#^Call to method getFile\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Storage\\.$#" + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Organizer\\:\\:getLanguageUid\\(\\) should return int but returns int\\<\\-1, max\\>\\|null\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Model/Organizer.php - - message: "#^Call to method hasFile\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Storage\\.$#" + message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\AbstractDomainObject\\:\\:\\$_languageUid \\(int\\<\\-1, max\\>\\|null\\) does not accept int\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Model/Organizer.php - - message: "#^Argument of an invalid type Doctrine\\\\DBAL\\\\Result\\|int supplied for foreach, only iterables are supported\\.$#" + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Region\\:\\:getLanguageUid\\(\\) should return int but returns int\\<\\-1, max\\>\\|null\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Model/Region.php - - message: "#^Argument of an invalid type Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int supplied for foreach, only iterables are supported\\.$#" + message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\AbstractDomainObject\\:\\:\\$_languageUid \\(int\\<\\-1, max\\>\\|null\\) does not accept int\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Model/Region.php - - message: "#^Cannot call method fetchAllAssociativeIndexed\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" + message: "#^Method WerkraumMedia\\\\Events\\\\Domain\\\\Repository\\\\LocationRepository\\:\\:findOneByGlobalId\\(\\) should return WerkraumMedia\\\\Events\\\\Domain\\\\Model\\\\Location\\|null but returns \\(T of object\\)\\|null\\.$#" count: 1 - path: Classes/Service/Cleanup/Files.php + path: Classes/Domain/Repository/LocationRepository.php - - message: "#^Method WerkraumMedia\\\\Events\\\\Service\\\\Cleanup\\\\Files\\:\\:getPotentialFilesToDelete\\(\\) should return array\\ but returns array\\\\>\\.$#" + message: "#^Cannot cast mixed to int\\.$#" count: 1 path: Classes/Service/Cleanup/Files.php - - message: "#^Parameter \\#1 \\$uid of class WerkraumMedia\\\\Events\\\\Service\\\\DestinationDataImportService\\\\DataHandler\\\\Assignment constructor expects int, int\\|null given\\.$#" - count: 2 - path: Classes/Service/DestinationDataImportService.php + message: "#^Cannot cast mixed to string\\.$#" + count: 1 + path: Classes/Service/Cleanup/Files.php - - message: "#^Parameter \\#3 \\$assignments of class WerkraumMedia\\\\Events\\\\Service\\\\DestinationDataImportService\\\\DataHandler\\\\Assignment constructor expects array\\, array\\ given\\.$#" - count: 2 - path: Classes/Service/DestinationDataImportService.php + message: "#^Method WerkraumMedia\\\\Events\\\\Service\\\\Cleanup\\\\Files\\:\\:getPotentialFilesToDelete\\(\\) should return array\\ but returns array\\\\>\\.$#" + count: 1 + path: Classes/Service/Cleanup/Files.php - message: "#^Method WerkraumMedia\\\\Events\\\\Service\\\\DestinationDataImportService\\\\CategoriesAssignment\\:\\:getCategories\\(\\) should return TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\ but returns TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\\\.$#" count: 2 path: Classes/Service/DestinationDataImportService/CategoriesAssignment.php - - - message: "#^Argument of an invalid type Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - - - message: "#^Cannot call method fetchAssociative\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - message: "#^Method WerkraumMedia\\\\Events\\\\Service\\\\DestinationDataImportService\\\\FilesAssignment\\:\\:getImages\\(\\) should return TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\ but returns TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage\\\\.$#" count: 1 path: Classes/Service/DestinationDataImportService/FilesAssignment.php - - - message: "#^Cannot call method fetchAllAssociativeIndexed\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - count: 1 - path: Classes/Service/Cleanup/Files.php - - - - message: "#^Argument of an invalid type Doctrine\\\\DBAL\\\\Result\\|int supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - - - message: "#^Cannot call method fetchAssociative\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - message: "#^Method WerkraumMedia\\\\Events\\\\Updates\\\\MigrateOldLocations\\:\\:getExitingLocationUid\\(\\) should return int but returns mixed\\.$#" count: 1 path: Classes/Updates/MigrateOldLocations.php - - - - message: "#^Offset 'sys_language_uid' does not exist on array\\{location\\: int\\}\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - - - message: "#^Offset 'uid' does not exist on array\\{location\\: int\\}\\.$#" - count: 1 - path: Classes/Updates/MigrateOldLocations.php - - - - - message: "#^Cannot call method getEnd\\(\\) on mixed\\.$#" - count: 1 - path: Classes/Caching/PageCacheTimeout.php diff --git a/phpstan.neon b/phpstan.neon index 186b490..b0c6ded 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,19 +7,4 @@ parameters: - Configuration checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false - reportUnmatchedIgnoredErrors: false - ignoreErrors: - - "#^Call to an undefined method Doctrine\\\\DBAL\\\\Result\\:\\:fetch\\(\\)\\.$#" - - "#^Cannot call method fetchAll\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetchAll\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Cannot call method fetchAllAssociative\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetchAllAssociative\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Cannot call method fetchColumn\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetchColumn\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Cannot call method fetchFirstColumn\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetchFirstColumn\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Cannot call method fetch\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetch\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Cannot call method fetchOne\\(\\) on Doctrine\\\\DBAL\\\\Driver\\\\ResultStatement\\|int\\.$#" - - "#^Cannot call method fetchOne\\(\\) on Doctrine\\\\DBAL\\\\Result\\|int\\.$#" - - "#^Parameter \\#1 \\.\\.\\.\\$predicates of method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\QueryBuilder\\:\\:where\\(\\) expects array\\\\|Doctrine\\\\DBAL\\\\Query\\\\Expression\\\\CompositeExpression, string given\\.$#" + reportUnmatchedIgnoredErrors: true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5f25438..455ab29 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,19 @@ - + cacheDirectory=".phpunit.cache" + backupStaticProperties="false" + requireCoverageMetadata="false" +> Tests/Unit/ @@ -26,14 +23,16 @@ - - - Classes - - + - + + + + + Classes + + diff --git a/shell.nix b/shell.nix index 90b74d5..9ebd466 100644 --- a/shell.nix +++ b/shell.nix @@ -23,7 +23,7 @@ let ]; text = '' rm -rf vendor/ composer.lock .Build/ - composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" + composer update --prefer-dist --no-progress ''; }; @@ -115,7 +115,7 @@ let }; in pkgs.mkShell { - name = "TYPO3 Extension Watchlist"; + name = "TYPO3 Extension Events"; buildInputs = [ projectInstall projectValidateComposer @@ -130,8 +130,6 @@ in pkgs.mkShell { ]; shellHook = '' - export PROJECT_ROOT="$(pwd)" - export typo3DatabaseDriver=pdo_sqlite ''; }