diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index f2bcef2a..c807b417 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -410,9 +410,9 @@ fi case ${TEST_SUITE} in cgl) if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then - COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --dry-run --diff --config=.php-cs-fixer.dist.php --using-cache=no ." + COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --dry-run --diff --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ." else - COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --config=.php-cs-fixer.dist.php --using-cache=no ." + COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ." fi ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name cgl-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}" SUITE_EXIT_CODE=$? diff --git a/Build/cgl/.php-cs-fixer.dist.php b/Build/cgl/.php-cs-fixer.dist.php new file mode 100644 index 00000000..8ae7d771 --- /dev/null +++ b/Build/cgl/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder()->in(__DIR__ . '/../../Classes'); +$config->getFinder()->in(__DIR__ . '/../../Configuration'); +$config->getFinder()->exclude('node_modules'); +$config->setCacheFile(__DIR__ . '/../../.Build/.cache/.php_cs.cache'); +return $config; diff --git a/Classes/Command/ImportCommand.php b/Classes/Command/ImportCommand.php index b1e3b5e0..36a78a1e 100644 --- a/Classes/Command/ImportCommand.php +++ b/Classes/Command/ImportCommand.php @@ -32,8 +32,6 @@ /** * Runs the External Import process from the command line. - * - * @package Cobweb\ExternalImport\Command */ class ImportCommand extends Command { @@ -54,8 +52,6 @@ class ImportCommand extends Command /** * Configures the command by setting its name, description and options. - * - * @return void */ public function configure() { @@ -185,9 +181,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int Importer::DEFAULT_PRIORITY => [ [ 'table' => $table, - 'index' => $index - ] - ] + 'index' => $index, + ], + ], ]; $this->runSynchronization($configurations); } else { @@ -212,8 +208,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** * Prints the list of synchronizable configurations as a table. - * - * @return void */ protected function printConfigurationList(): void { @@ -225,7 +219,7 @@ protected function printConfigurationList(): void $priority, $configuration['table'], $configuration['index'], - $configuration['group'] + $configuration['group'], ]; } } @@ -239,7 +233,6 @@ protected function printConfigurationList(): void * Runs the synchronization of the given list of configurations. * * @param array $configurations List of External Import configurations - * @return void */ protected function runSynchronization(array $configurations): void { @@ -290,4 +283,4 @@ protected function reportResults(array $messages): void } } } -} \ No newline at end of file +} diff --git a/Classes/Context/AbstractCallContext.php b/Classes/Context/AbstractCallContext.php index 1c77913e..03f6c920 100644 --- a/Classes/Context/AbstractCallContext.php +++ b/Classes/Context/AbstractCallContext.php @@ -25,8 +25,6 @@ * Call contexts are used to react to some output from the Importer class which needs some special handling * depending on the context in which the call happens (command-line, scheduler, etc.). This offloads the * responsibility of all these contexts from the Importer class itself. - * - * @package Cobweb\ExternalImport\Step */ abstract class AbstractCallContext { @@ -46,7 +44,6 @@ public function __construct(Importer $importer) * @param string $message Message to display * @param int $severity Degree of severity * @param mixed $data Additional data to display - * @return void */ abstract public function outputDebug(string $message, int $severity, $data): void; -} \ No newline at end of file +} diff --git a/Classes/Context/CommandLineCallContext.php b/Classes/Context/CommandLineCallContext.php index e8c2bb57..fe254beb 100644 --- a/Classes/Context/CommandLineCallContext.php +++ b/Classes/Context/CommandLineCallContext.php @@ -21,8 +21,6 @@ /** * This is a concrete implementation of the call context for the CLI context. - * - * @package Cobweb\ExternalImport\Step */ class CommandLineCallContext extends AbstractCallContext { @@ -47,7 +45,6 @@ public function setInputOutput(SymfonyStyle $io): void * @param string $message Message to display * @param int $severity Degree of severity * @param mixed $data Additional data to display - * @return void */ public function outputDebug(string $message, int $severity, $data): void { @@ -74,4 +71,4 @@ public function outputDebug(string $message, int $severity, $data): void $this->io->writeln('-------------------------------------------------------------------'); } } -} \ No newline at end of file +} diff --git a/Classes/Controller/DataModuleController.php b/Classes/Controller/DataModuleController.php index 8093c2e9..1d13bf66 100644 --- a/Classes/Controller/DataModuleController.php +++ b/Classes/Controller/DataModuleController.php @@ -43,7 +43,6 @@ */ class DataModuleController extends ActionController { - protected ModuleTemplateFactory $moduleTemplateFactory; protected ?ModuleTemplate $moduleTemplate = null; @@ -122,8 +121,8 @@ public function listSynchronizableAction(): ResponseInterface 'scheduler' => $this->getBackendUser()->check( 'custom_options', 'tx_externalimport_bemodule_actions:scheduler' - ) - ] + ), + ], ] ); @@ -158,7 +157,7 @@ public function listNonSynchronizableAction(): ResponseInterface } $this->view->assignMultiple( [ - 'configurations' => $configurations + 'configurations' => $configurations, ] ); @@ -230,7 +229,7 @@ public function previewAction(string $table, string $index, string $stepClass = 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ), '', @@ -244,7 +243,7 @@ public function previewAction(string $table, string $index, string $stepClass = 'steps' => $stepList, 'stepClass' => $stepClass, 'previewData' => $previewData, - 'downloadable' => $downloadable + 'downloadable' => $downloadable, ] ); @@ -348,7 +347,7 @@ public function viewConfigurationAction(string $table, string $index): ResponseI 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ), '', @@ -370,7 +369,7 @@ public function viewConfigurationAction(string $table, string $index): ResponseI 'table' => $table, 'index' => $index, 'configuration' => $configuration, - 'storageRecord' => BackendUtility::getRecord('pages', $configuration->getStoragePid()) + 'storageRecord' => BackendUtility::getRecord('pages', $configuration->getStoragePid()), ], ); @@ -440,7 +439,7 @@ public function createTaskAction( 'autosync_save_failed', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ), '', @@ -519,7 +518,7 @@ public function updateTaskAction(int $uid, string $frequency, int $group): Respo 'autosync_save_failed', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ), '', @@ -551,7 +550,7 @@ public function deleteTaskAction(int $uid): ResponseInterface 'delete_failed', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ), '', @@ -568,7 +567,6 @@ public function deleteTaskAction(int $uid): ResponseInterface * * @param string $menuAction * @param string $closeButtonAction - * @return void */ protected function prepareView(string $menuAction = '', string $closeButtonAction = ''): void { @@ -585,8 +583,6 @@ protected function prepareView(string $menuAction = '', string $closeButtonActio /** * Loads the resources (JS, CSS) needed by some action views. - * - * @return void */ protected function loadResources(): void { @@ -597,8 +593,8 @@ protected function loadResources(): void $this->pageRenderer->addRequireJsConfiguration( [ 'paths' => [ - 'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables' - ] + 'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables', + ], ] ); $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/ExternalImport/DataModule'); @@ -613,7 +609,6 @@ protected function loadResources(): void * Defines the menu items in the docheader. * * @param string $action - * @return void */ protected function prepareMainMenu(string $action): void { @@ -644,7 +639,6 @@ protected function prepareMainMenu(string $action): void * Adds a close button to the docheader. * * @param string $returnAction Name of the action to return to - * @return void */ protected function prepareCloseButton(string $returnAction): void { diff --git a/Classes/Controller/LogAjaxController.php b/Classes/Controller/LogAjaxController.php index de7c6a31..2bc2b1d8 100644 --- a/Classes/Controller/LogAjaxController.php +++ b/Classes/Controller/LogAjaxController.php @@ -26,12 +26,9 @@ /** * Controller for the AJAX calls of the "Log" module - * - * @package Cobweb\ExternalImport\Controller */ class LogAjaxController { - /** * Returns the list of all log entries, in JSON format. * @@ -69,7 +66,7 @@ public function getAction(ServerRequestInterface $request, ResponseInterface $re 'configuration' => $logEntry->getConfiguration(), 'context' => $logEntry->getContext(), 'message' => $logEntry->getMessage(), - 'duration' => $logEntry->getDuration() + 'duration' => $logEntry->getDuration(), ]; } } catch (\Exception $e) { @@ -85,7 +82,7 @@ public function getAction(ServerRequestInterface $request, ResponseInterface $re 'data' => $logs, 'recordsTotal' => $totalEntries, 'recordsFiltered' => $logCount, - 'error' => $error + 'error' => $error, ]; if ($response === null) { $response = GeneralUtility::makeInstance(JsonResponse::class); @@ -93,4 +90,4 @@ public function getAction(ServerRequestInterface $request, ResponseInterface $re $response->getBody()->write(json_encode($fullResponse, JSON_THROW_ON_ERROR)); return $response; } -} \ No newline at end of file +} diff --git a/Classes/Controller/LogModuleController.php b/Classes/Controller/LogModuleController.php index b001535d..9c7b5b83 100644 --- a/Classes/Controller/LogModuleController.php +++ b/Classes/Controller/LogModuleController.php @@ -33,7 +33,6 @@ */ class LogModuleController extends ActionController { - protected ModuleTemplateFactory $moduleTemplateFactory; protected ?ModuleTemplate $moduleTemplate = null; @@ -63,8 +62,6 @@ public function initializeAction(): void /** * Loads the resources (JS, CSS) needed by some action views. - * - * @return void */ protected function loadResources(): void { @@ -80,7 +77,7 @@ protected function loadResources(): void [ 'paths' => [ 'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables', - ] + ], ] ); // TODO: remove and replace with Luxon when compatibility with v11 is dropped @@ -89,8 +86,8 @@ protected function loadResources(): void $this->pageRenderer->addRequireJsConfiguration( [ 'paths' => [ - 'moment' => $publicResourcesPath . 'JavaScript/Contrib/moment' - ] + 'moment' => $publicResourcesPath . 'JavaScript/Contrib/moment', + ], ] ); } diff --git a/Classes/DataHandlerInterface.php b/Classes/DataHandlerInterface.php index 633046f4..0786279c 100644 --- a/Classes/DataHandlerInterface.php +++ b/Classes/DataHandlerInterface.php @@ -21,7 +21,6 @@ * Interface which defines the method to implement when creating a custom data handler for External Import * * Interface DataHandlerInterface - * @package Cobweb\ExternalImport */ interface DataHandlerInterface { diff --git a/Classes/Domain/Model/BackendUser.php b/Classes/Domain/Model/BackendUser.php index 845447e5..997f6045 100644 --- a/Classes/Domain/Model/BackendUser.php +++ b/Classes/Domain/Model/BackendUser.php @@ -41,4 +41,4 @@ public function setUserName(string $userName): void { $this->userName = $userName; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/ChildrenConfiguration.php b/Classes/Domain/Model/ChildrenConfiguration.php index e1916ce6..42cfe82a 100644 --- a/Classes/Domain/Model/ChildrenConfiguration.php +++ b/Classes/Domain/Model/ChildrenConfiguration.php @@ -111,7 +111,6 @@ public function setControlColumnsForDelete(array $controlColumnsForDelete): void * * @param string $operation * @param bool $flag - * @return void */ public function setAllowedOperation(string $operation, bool $flag): void { @@ -190,4 +189,4 @@ public function setSorting(array $sorting): void { $this->sorting = $sorting; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Configuration.php b/Classes/Domain/Model/Configuration.php index 95eca003..5aa8ba91 100644 --- a/Classes/Domain/Model/Configuration.php +++ b/Classes/Domain/Model/Configuration.php @@ -24,8 +24,6 @@ /** * Pseudo-domain model for a single External Import configuration. - * - * @package Cobweb\ExternalImport\Domain\Model */ class Configuration { @@ -105,8 +103,6 @@ public function __toString() /** * Restructures part of the configuration for easier use during the import process. - * - * @return void */ public function processConfiguration(): void { @@ -200,7 +196,6 @@ public function getGeneralConfiguration(): array * * @param array $generalConfiguration * @param array|null $defaultSteps List of default steps (if null will be guessed by the repository) - * @return void */ public function setGeneralConfiguration(array $generalConfiguration, array $defaultSteps = null): void { @@ -508,8 +503,6 @@ public function sortColumns(array $columns, string $sorting = ''): array /** * Makes sure that the transformation properties are sorted. - * - * @return void */ protected function sortTransformationProperties(): void { @@ -536,10 +529,10 @@ protected function isNullable(string $name): bool // Check for explicit nullable property (TYPO3 12+) if (array_key_exists('nullable', $columnTca)) { $nullable = (bool)$columnTca['nullable']; - // If not defined, try for "null" evaluation (TYPO3 11) + // If not defined, try for "null" evaluation (TYPO3 11) } elseif (array_key_exists('eval', $columnTca)) { $nullable = GeneralUtility::inList($columnTca['eval'], 'null'); } return $nullable; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/ConfigurationKey.php b/Classes/Domain/Model/ConfigurationKey.php index ab6e6e82..07a926d4 100644 --- a/Classes/Domain/Model/ConfigurationKey.php +++ b/Classes/Domain/Model/ConfigurationKey.php @@ -26,8 +26,6 @@ * will fail. * * Not an Extbase model. - * - * @package Cobweb\ExternalImport\Domain\Model */ class ConfigurationKey { @@ -110,4 +108,4 @@ public function getIndex(): string { return $this->index; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Data.php b/Classes/Domain/Model/Data.php index e48b4939..68a22bdf 100644 --- a/Classes/Domain/Model/Data.php +++ b/Classes/Domain/Model/Data.php @@ -19,8 +19,6 @@ /** * Pseudo-domain model for the data being handled by the import process. - * - * @package Cobweb\ExternalImport\Domain\Model */ class Data { @@ -115,4 +113,4 @@ public function setDownloadable(bool $downloadable): void { $this->downloadable = $downloadable; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Dto/ChildrenSorting.php b/Classes/Domain/Model/Dto/ChildrenSorting.php index 1598c551..f54e0983 100644 --- a/Classes/Domain/Model/Dto/ChildrenSorting.php +++ b/Classes/Domain/Model/Dto/ChildrenSorting.php @@ -51,8 +51,6 @@ public function getSortingInformation(): array /** * Resets the sorting information - * - * @return void */ public function resetSortingInformation(): void { @@ -66,7 +64,6 @@ public function resetSortingInformation(): void * @param mixed $id Id of the child record * @param string $target Name of the sorting field * @param mixed $value Sorting value - * @return void */ public function addSortingInformation(string $table, $id, string $target, $value): void { @@ -74,7 +71,7 @@ public function addSortingInformation(string $table, $id, string $target, $value $this->sortingInformation[$table] = []; } $this->sortingInformation[$table][$id] = [ - $target => (int)$value + $target => (int)$value, ]; } @@ -84,7 +81,6 @@ public function addSortingInformation(string $table, $id, string $target, $value * @param string $table Name of the child table * @param mixed $oldId Old id of the child record (could have been a temporary key) * @param int $id Final id of the child record - * @return void */ public function replaceId(string $table, $oldId, int $id): void { @@ -98,7 +94,6 @@ public function replaceId(string $table, $oldId, int $id): void * Replaces temporary keys with final ids, after database storage * * @param array $replacements Hashmap of old to new ids (normally coming from TCE) - * @return void */ public function replaceAllNewIds(array $replacements): void { @@ -113,4 +108,4 @@ public function replaceAllNewIds(array $replacements): void } } } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Dto/QueryParameters.php b/Classes/Domain/Model/Dto/QueryParameters.php index 437f646d..f188fa87 100644 --- a/Classes/Domain/Model/Dto/QueryParameters.php +++ b/Classes/Domain/Model/Dto/QueryParameters.php @@ -21,8 +21,6 @@ /** * Data Transfer Object model for AJAX query parameters coming from DataTables. - * - * @package Cobweb\ExternalImport\Domain\Model\Dto */ class QueryParameters { @@ -224,4 +222,4 @@ public function setDirection(string $direction): void } $this->direction = $direction; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Log.php b/Classes/Domain/Model/Log.php index cb56da1d..973304ef 100644 --- a/Classes/Domain/Model/Log.php +++ b/Classes/Domain/Model/Log.php @@ -22,8 +22,6 @@ /** * Model for the log table. - * - * @package Cobweb\ExternalImport\Domain\Model */ class Log extends AbstractEntity { diff --git a/Classes/Domain/Model/ProcessedConfiguration.php b/Classes/Domain/Model/ProcessedConfiguration.php index 68b60251..d7e92185 100644 --- a/Classes/Domain/Model/ProcessedConfiguration.php +++ b/Classes/Domain/Model/ProcessedConfiguration.php @@ -143,4 +143,4 @@ public function isNullableColumn(string $name): bool { return in_array($name, $this->nullableColumns, true); } -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/BackendUserRepository.php b/Classes/Domain/Repository/BackendUserRepository.php index 89124ff5..f4e076aa 100644 --- a/Classes/Domain/Repository/BackendUserRepository.php +++ b/Classes/Domain/Repository/BackendUserRepository.php @@ -21,5 +21,4 @@ class BackendUserRepository extends Repository { - -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/ChildrenRepository.php b/Classes/Domain/Repository/ChildrenRepository.php index a3739153..585ff4fc 100644 --- a/Classes/Domain/Repository/ChildrenRepository.php +++ b/Classes/Domain/Repository/ChildrenRepository.php @@ -25,8 +25,6 @@ /** * Class for querying the database with some precise conditions * (see \Cobweb\ExternalImport\Step\StoreDataStep::reviewChildRecords()) - * - * @package Cobweb\ExternalImport\Domain\Repository */ class ChildrenRepository { @@ -104,4 +102,4 @@ protected function prepareQueryBuilder(string $table, array $conditions): QueryB } return $queryBuilder; } -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/ConfigurationRepository.php b/Classes/Domain/Repository/ConfigurationRepository.php index 690d8a4a..b26f660f 100644 --- a/Classes/Domain/Repository/ConfigurationRepository.php +++ b/Classes/Domain/Repository/ConfigurationRepository.php @@ -30,8 +30,6 @@ * * This is not a true repository in the Extbase sense of the term, as it relies on reading its information * from the TCA and not a database. It also does not provide any persistence. - * - * @package Cobweb\ExternalImport\Domain\Repository */ class ConfigurationRepository { @@ -70,7 +68,7 @@ public function findByTableAndIndex(string $table, $index): array $configuration = [ 'general' => [], 'additionalFields' => [], - 'columns' => [] + 'columns' => [], ]; // General configuration @@ -78,8 +76,8 @@ public function findByTableAndIndex(string $table, $index): array $configuration['general'] = $this->processGeneralConfiguration( $GLOBALS['TCA'][$table]['external']['general'][$index] ); - // Check for legacy general configuration - // TODO: remove in version 8.0 + // Check for legacy general configuration + // TODO: remove in version 8.0 } elseif (isset($GLOBALS['TCA'][$table]['ctrl']['external'][$index])) { $configuration['general'] = $this->processGeneralConfiguration( $GLOBALS['TCA'][$table]['ctrl']['external'][$index] @@ -141,7 +139,7 @@ public function findOrderedConfigurations(): array $externalTables[$priority][] = [ 'table' => $tableName, 'index' => $index, - 'group' => $externalConfig['group'] ?? '-' + 'group' => $externalConfig['group'] ?? '-', ]; } } @@ -174,7 +172,7 @@ public function findByGroup(string $group): array } $externalTables[$priority][] = [ 'table' => $tableName, - 'index' => $index + 'index' => $index, ]; } } @@ -303,7 +301,7 @@ public function findBySync(bool $isSynchronizable): array 'priority' => $priority, 'group' => $externalConfiguration['group'] ?? '', 'description' => htmlspecialchars($description), - 'writeAccess' => $hasWriteAccess + 'writeAccess' => $hasWriteAccess, ]; // Add Scheduler task information, if any // If the configuration is part of a group and that group is automated, return task information too, diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 0afcc8c5..c90d36ce 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -26,12 +26,9 @@ /** * Repository for the log table. - * - * @package Cobweb\ExternalImport\Domain\Repository */ class LogRepository extends Repository { - public function __toString() { return self::class; @@ -69,7 +66,7 @@ public function findBySearch(QueryParameters $queryParameters) if ($queryParameters->getOrder() !== '') { $query->setOrderings( [ - $queryParameters->getOrder() => $queryParameters->getDirection() + $queryParameters->getOrder() => $queryParameters->getDirection(), ] ); } diff --git a/Classes/Domain/Repository/SchedulerRepository.php b/Classes/Domain/Repository/SchedulerRepository.php index e54607f4..cccff2be 100644 --- a/Classes/Domain/Repository/SchedulerRepository.php +++ b/Classes/Domain/Repository/SchedulerRepository.php @@ -32,8 +32,6 @@ * Pseudo-repository class for Scheduler tasks * * This is not a true repository from an Extbase point of view. It implements only a few features of a complete repository. - * - * @package Cobweb\ExternalImport\Domain\Repository */ class SchedulerRepository implements SingletonInterface { @@ -144,7 +142,7 @@ public function fetchFullSynchronizationTask(): array public function fetchAllGroups(): array { $groups = [ - 0 => '' + 0 => '', ]; try { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) @@ -199,7 +197,7 @@ protected function assembleTaskInformation(AutomatedSyncTask $taskObject): array 'startDate' => empty($startTimestamp) ? '' : date( $editFormat, $taskObject->getExecution()->getStart() - ) + ), ]; } @@ -209,7 +207,6 @@ protected function assembleTaskInformation(AutomatedSyncTask $taskObject): array * If no uid is given, a new task is created. * * @param array $taskData List of fields to save. Must include "uid" for an existing registered task - * @return void * @throws \Cobweb\ExternalImport\Exception\SchedulerRepositoryException */ public function saveTask(array $taskData): void @@ -297,7 +294,7 @@ public function prepareTaskData( 'index' => $index, 'group' => $group, 'interval' => 0, - 'croncmd' => '' + 'croncmd' => '', ]; // Handle frequency, which may be a simple number of seconds or a cron command // Try interpreting the frequency as a cron command diff --git a/Classes/Domain/Repository/TemporaryKeyRepository.php b/Classes/Domain/Repository/TemporaryKeyRepository.php index bb2508e8..9329e3cd 100644 --- a/Classes/Domain/Repository/TemporaryKeyRepository.php +++ b/Classes/Domain/Repository/TemporaryKeyRepository.php @@ -22,12 +22,9 @@ /** * Class for managing the generation and storage of temporary keys - * - * @package Cobweb\ExternalImport\Domain\Repository */ class TemporaryKeyRepository { - /** * @var int Incremental number to be used for temporary keys during test mode (used for unit testing) */ @@ -137,7 +134,6 @@ public function addTemporaryKey($value, string $key, string $table): void * This is meant for unit testing only. * * @param bool $mode Set to true for test mode - * @return void */ public function setTestMode(bool $mode): void { @@ -153,5 +149,4 @@ public function isTestMode(): bool { return $this->testMode; } - -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/UidRepository.php b/Classes/Domain/Repository/UidRepository.php index 39bbcfec..6a182860 100644 --- a/Classes/Domain/Repository/UidRepository.php +++ b/Classes/Domain/Repository/UidRepository.php @@ -25,8 +25,6 @@ /** * Class used for retrieving UIDs according to external configuration. - * - * @package Cobweb\ExternalImport\Domain\Repository */ class UidRepository { @@ -62,7 +60,6 @@ public function setConfiguration(Configuration $configuration): void * PIDs are also retrieved. This method is internal, its usage is triggered when using the getter * methods. * - * @return void * @throws MissingConfigurationException */ protected function retrieveExistingUids(): void @@ -128,8 +125,6 @@ public function getExistingUids(): ?array /** * Resets the list of primary keys. - * - * @return void */ public function resetExistingUids(): void { @@ -153,11 +148,9 @@ public function getCurrentPids(): ?array /** * Resets the list of storage PIDs. - * - * @return void */ public function resetCurrentPids(): void { $this->currentPids = null; } -} \ No newline at end of file +} diff --git a/Classes/Event/CmdmapPostprocessEvent.php b/Classes/Event/CmdmapPostprocessEvent.php index 1a6797dd..1e0d976e 100644 --- a/Classes/Event/CmdmapPostprocessEvent.php +++ b/Classes/Event/CmdmapPostprocessEvent.php @@ -21,8 +21,6 @@ /** * Event for reacting to the list of records that were removed from the database. - * - * @package Cobweb\ExternalImport\Event */ final class CmdmapPostprocessEvent { @@ -57,4 +55,4 @@ public function getRecords(): array { return $this->records; } -} \ No newline at end of file +} diff --git a/Classes/Event/DatamapPostprocessEvent.php b/Classes/Event/DatamapPostprocessEvent.php index e2ba9e50..7a51fcbc 100644 --- a/Classes/Event/DatamapPostprocessEvent.php +++ b/Classes/Event/DatamapPostprocessEvent.php @@ -1,4 +1,5 @@ data; } -} \ No newline at end of file +} diff --git a/Classes/Event/DeleteRecordsPreprocessEvent.php b/Classes/Event/DeleteRecordsPreprocessEvent.php index 864e211f..a1bf5f1b 100644 --- a/Classes/Event/DeleteRecordsPreprocessEvent.php +++ b/Classes/Event/DeleteRecordsPreprocessEvent.php @@ -21,8 +21,6 @@ /** * Event for manipulating the list of records that will be removed from the database. - * - * @package Cobweb\ExternalImport\Event */ final class DeleteRecordsPreprocessEvent { @@ -65,5 +63,4 @@ public function setRecords(array $records): void { $this->records = $records; } - -} \ No newline at end of file +} diff --git a/Classes/Event/InsertRecordPreprocessEvent.php b/Classes/Event/InsertRecordPreprocessEvent.php index 3f42dae0..0ddc490c 100644 --- a/Classes/Event/InsertRecordPreprocessEvent.php +++ b/Classes/Event/InsertRecordPreprocessEvent.php @@ -21,8 +21,6 @@ /** * Event for manipulating the data of a single record before it is inserted into the database. - * - * @package Cobweb\ExternalImport\Event */ final class InsertRecordPreprocessEvent { @@ -65,5 +63,4 @@ public function setRecord(array $record): void { $this->record = $record; } - -} \ No newline at end of file +} diff --git a/Classes/Event/ProcessConnectorParametersEvent.php b/Classes/Event/ProcessConnectorParametersEvent.php index 7720b05b..ac225a9b 100644 --- a/Classes/Event/ProcessConnectorParametersEvent.php +++ b/Classes/Event/ProcessConnectorParametersEvent.php @@ -21,8 +21,6 @@ /** * Event for manipulating connector parameters. - * - * @package Cobweb\ExternalImport\Event */ final class ProcessConnectorParametersEvent { @@ -71,4 +69,4 @@ public function getExternalConfiguration(): Configuration { return $this->externalConfiguration; } -} \ No newline at end of file +} diff --git a/Classes/Event/ReportEvent.php b/Classes/Event/ReportEvent.php index 6b19f96e..b93caca2 100644 --- a/Classes/Event/ReportEvent.php +++ b/Classes/Event/ReportEvent.php @@ -37,5 +37,4 @@ public function getImporter(): Importer { return $this->importer; } - -} \ No newline at end of file +} diff --git a/Classes/Event/SubstructurePreprocessEvent.php b/Classes/Event/SubstructurePreprocessEvent.php index e471b9e8..0cf539c4 100644 --- a/Classes/Event/SubstructurePreprocessEvent.php +++ b/Classes/Event/SubstructurePreprocessEvent.php @@ -21,8 +21,6 @@ /** * Event for manipulating a single substructure before it is accessed with the keys defined with the "substructureFields" property. - * - * @package Cobweb\ExternalImport\Event */ final class SubstructurePreprocessEvent { @@ -107,5 +105,4 @@ public function setSubstructure($substructure): void { $this->substructure = $substructure; } - -} \ No newline at end of file +} diff --git a/Classes/Event/UpdateRecordPreprocessEvent.php b/Classes/Event/UpdateRecordPreprocessEvent.php index df1917e7..e23ce4c3 100644 --- a/Classes/Event/UpdateRecordPreprocessEvent.php +++ b/Classes/Event/UpdateRecordPreprocessEvent.php @@ -21,8 +21,6 @@ /** * Event for manipulating the data of a single record before it is updated in the database. - * - * @package Cobweb\ExternalImport\Event */ final class UpdateRecordPreprocessEvent { @@ -79,5 +77,4 @@ public function setRecord(array $record): void { $this->record = $record; } - -} \ No newline at end of file +} diff --git a/Classes/EventListener/DatabaseSchemaEventListener.php b/Classes/EventListener/DatabaseSchemaEventListener.php index 610c42db..bb520ae6 100644 --- a/Classes/EventListener/DatabaseSchemaEventListener.php +++ b/Classes/EventListener/DatabaseSchemaEventListener.php @@ -38,4 +38,4 @@ public function __invoke(AlterTableDefinitionStatementsEvent $event): void $event->addSqlData($sql); } } -} \ No newline at end of file +} diff --git a/Classes/Exception/CriticalFailureException.php b/Classes/Exception/CriticalFailureException.php index 225c7d15..11d2031e 100644 --- a/Classes/Exception/CriticalFailureException.php +++ b/Classes/Exception/CriticalFailureException.php @@ -20,10 +20,7 @@ /** * Exception that should be thrown whenever a failed operation should stop the whole import, * rather than just having a single record fail. See the documentation for more information. - * - * @package Cobweb\ExternalImport\Exception */ class CriticalFailureException extends Exception { - -} \ No newline at end of file +} diff --git a/Classes/Exception/InvalidCustomStepConfiguration.php b/Classes/Exception/InvalidCustomStepConfiguration.php index bd9d1e15..6d48119b 100644 --- a/Classes/Exception/InvalidCustomStepConfiguration.php +++ b/Classes/Exception/InvalidCustomStepConfiguration.php @@ -1,4 +1,5 @@ FooAB - // BarC - // With an XPath like "//author" I expect to have a list of all authors, one after the other - // no matter which book they belong to. I don't expect to have a first array with A and C - // and a second array with C. + // Otherwise, we want to create a list of all elements inside the resulting items + // (this emulates the selection of sub-nodes with XPath, consider a structure like: + // FooAB + // BarC + // With an XPath like "//author" I expect to have a list of all authors, one after the other + // no matter which book they belong to. I don't expect to have a first array with A and C + // and a second array with C. } else { foreach ($resultingItems as $resultingItem) { $newValue[] = $resultingItem; @@ -329,7 +327,7 @@ public function getArrayPathStructure(array $array, array $segments, bool $flatt // Set result depending on number of matches if (count($newValue) === 0) { $value = null; - // There's a single result and it should not be made into an array + // There's a single result and it should not be made into an array } elseif ($flattenResults && count($newValue) === 1) { $value = array_shift($newValue); } else { @@ -339,7 +337,7 @@ public function getArrayPathStructure(array $array, array $segments, bool $flatt // Leftover segments have been used on child item, they must not be used on the resulting value anymore $segments = []; - // Consider the next value along the path + // Consider the next value along the path } elseif (array_key_exists($key, $value)) { // If an item was found and a condition is defined, try to match it if ($condition !== '') { @@ -381,7 +379,7 @@ protected function applyCondition(string $condition, $value): bool $testValue = $value; } else { $testValue = [ - 'value' => $value + 'value' => $value, ]; } return (bool)$this->expressionLanguage->evaluate( @@ -389,4 +387,4 @@ protected function applyCondition(string $condition, $value): bool $testValue ); } -} \ No newline at end of file +} diff --git a/Classes/Handler/XmlHandler.php b/Classes/Handler/XmlHandler.php index c1edb429..04633096 100644 --- a/Classes/Handler/XmlHandler.php +++ b/Classes/Handler/XmlHandler.php @@ -25,8 +25,6 @@ /** * Remaps data from an XML structure to an array mapped to TCA columns. - * - * @package Cobweb\ExternalImport\Handler */ class XmlHandler implements DataHandlerInterface { @@ -180,7 +178,7 @@ public function getValue(\DOMNode $record, array $columnConfiguration, \DOMXPath if (isset($columnConfiguration['value'])) { $value = $columnConfiguration['value']; - // If a "field" is defined, refine the selection to get the correct node + // If a "field" is defined, refine the selection to get the correct node } elseif (isset($columnConfiguration['field'])) { // Use namespace or not if (empty($columnConfiguration['fieldNS'])) { @@ -392,4 +390,4 @@ public function getSubstructureValues(\DOMNodeList $structure, array $columnConf } return $rows; } -} \ No newline at end of file +} diff --git a/Classes/Importer.php b/Classes/Importer.php index 69387336..23c62bca 100644 --- a/Classes/Importer.php +++ b/Classes/Importer.php @@ -36,8 +36,6 @@ /** * This class drives the import process by moving from step to step, aborting when necessary and triggering the reporting. - * - * @package Cobweb\ExternalImport */ class Importer implements LoggerAwareInterface { @@ -214,7 +212,6 @@ public function __toString() * @param string $table Name of the table to synchronise * @param mixed $index Index of the synchronisation configuration to use * @param array|null $defaultSteps List of default steps (if null will be guessed by the Configuration object) - * @return void * @throws NoConfigurationException */ protected function initialize(string $table, $index, array $defaultSteps = null): void @@ -224,9 +221,9 @@ protected function initialize(string $table, $index, array $defaultSteps = null) // Fetch the requested configuration $this->externalConfiguration = $this->configurationRepository->findConfigurationObject( - $table, - $index, - $defaultSteps + $table, + $index, + $defaultSteps ); if ($this->forcedStoragePid !== null) { $this->externalConfiguration->setStoragePid($this->forcedStoragePid); @@ -265,7 +262,7 @@ public function synchronize(string $table, $index): array 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:wrongPreviewStep', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ), AbstractMessage::WARNING @@ -279,7 +276,7 @@ public function synchronize(string $table, $index): array $table, $index, $e->getMessage(), - $e->getCode() + $e->getCode(), ] ) ); @@ -290,7 +287,7 @@ public function synchronize(string $table, $index): array 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ) ); @@ -332,7 +329,7 @@ public function import(string $table, $index, $rawData): array 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:wrongPreviewStep', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ) ); @@ -345,7 +342,7 @@ public function import(string $table, $index, $rawData): array $table, $index, $e->getMessage(), - $e->getCode() + $e->getCode(), ] ) ); @@ -356,7 +353,7 @@ public function import(string $table, $index, $rawData): array 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ) ); @@ -368,7 +365,6 @@ public function import(string $table, $index, $rawData): array /** * Runs the process through the defined steps. * - * @return void * @throws Exception\InvalidPreviewStepException */ public function runSteps(): void @@ -380,8 +376,8 @@ public function runSteps(): void // NOTE: this cannot be checked during a setPreviewStep() call as the configuration is not yet loaded if ($this->isPreview() && !in_array($this->getPreviewStep(), $steps, true)) { throw new InvalidPreviewStepException( - $this->getPreviewStep(), - 1532072718 + $this->getPreviewStep(), + 1532072718 ); } // Loop on all the process steps @@ -477,7 +473,6 @@ public function getExtensionConfiguration(): array * @param string $message The debug message * @param int $severity The severity of the issue * @param null $data Data associated with the debugging information - * @return void */ public function debug(string $message, int $severity = 0, $data = null): void { @@ -538,7 +533,6 @@ public function debug(string $message, int $severity = 0, $data = null): void * * @param string $text The message itself * @param int $status Status of the message. Expected is "success", "warning" or "error" - * @return void */ public function addMessage(string $text, int $status = AbstractMessage::ERROR): void { @@ -559,15 +553,13 @@ public function getMessages(): array /** * Empties the internal message queue. - * - * @return void */ public function resetMessages(): void { $this->messages = [ AbstractMessage::ERROR => [], AbstractMessage::WARNING => [], - AbstractMessage::OK => [] + AbstractMessage::OK => [], ]; } @@ -765,8 +757,6 @@ public function setPreviewData($previewData): void /** * Resets the preview data to null. - * - * @return void */ public function resetPreviewData(): void { @@ -820,7 +810,6 @@ public function setEndTime(int $endTime): void * This is meant for unit testing only. * * @param bool $mode Set to true for test mode - * @return void */ public function setTestMode(bool $mode): void { diff --git a/Classes/ImporterAwareInterface.php b/Classes/ImporterAwareInterface.php index 42adb782..fd7a1f7d 100644 --- a/Classes/ImporterAwareInterface.php +++ b/Classes/ImporterAwareInterface.php @@ -19,10 +19,8 @@ /** * Describes an Importer-aware class. - * - * @package Cobweb\ExternalImport */ interface ImporterAwareInterface { public function setImporter(Importer $importer); -} \ No newline at end of file +} diff --git a/Classes/ImporterAwareTrait.php b/Classes/ImporterAwareTrait.php index 86acd9a6..bbe623f3 100644 --- a/Classes/ImporterAwareTrait.php +++ b/Classes/ImporterAwareTrait.php @@ -19,8 +19,6 @@ /** * Implements the ImporterAware interface. - * - * @package Cobweb\ExternalImport */ trait ImporterAwareTrait { @@ -48,4 +46,4 @@ public function getImporter(): Importer { return $this->importer; } -} \ No newline at end of file +} diff --git a/Classes/Message/AfterImportMessage.php b/Classes/Message/AfterImportMessage.php index eefaa092..4204c4d9 100644 --- a/Classes/Message/AfterImportMessage.php +++ b/Classes/Message/AfterImportMessage.php @@ -67,4 +67,4 @@ public function jsonSerialize(): array ]; return $response; } -} \ No newline at end of file +} diff --git a/Classes/Reaction/ImportReaction.php b/Classes/Reaction/ImportReaction.php index 4fc73a6c..3b409574 100644 --- a/Classes/Reaction/ImportReaction.php +++ b/Classes/Reaction/ImportReaction.php @@ -95,13 +95,12 @@ public function react(ServerRequestInterface $request, array $payload, ReactionI // If import completed successfully, report about success and possible warnings $responseBody = [ 'success' => true, - 'messages' => $messages[AbstractMessage::OK] + 'messages' => $messages[AbstractMessage::OK], ]; if (count($messages[AbstractMessage::WARNING]) > 0) { $responseBody['warnings'] .= $messages[AbstractMessage::WARNING]; } return $this->jsonResponse($responseBody); - } catch (InvalidPayloadException $e) { return $this->jsonResponse( [ @@ -110,7 +109,7 @@ public function react(ServerRequestInterface $request, array $payload, ReactionI '%s [%d]', $e->getMessage(), $e->getCode() - ) + ), ], 400 ); @@ -180,4 +179,4 @@ protected function jsonResponse(array $data, int $statusCode = 200): ResponseInt ->withHeader('Content-Type', 'application/json') ->withBody($this->streamFactory->createStream((string)json_encode($data))); } -} \ No newline at end of file +} diff --git a/Classes/Step/AbstractStep.php b/Classes/Step/AbstractStep.php index 24bb73da..e2c54707 100644 --- a/Classes/Step/AbstractStep.php +++ b/Classes/Step/AbstractStep.php @@ -23,8 +23,6 @@ /** * Abstract class from which all External Import process steps **must** inherit. - * - * @package Cobweb\ExternalImport\Step */ abstract class AbstractStep implements ImporterAwareInterface { @@ -52,8 +50,6 @@ abstract class AbstractStep implements ImporterAwareInterface /** * Performs the actual tasks of the step. - * - * @return void */ abstract public function run(): void; @@ -61,7 +57,6 @@ abstract public function run(): void; * Sets the preview data for the Importer class. * * @param mixed $data - * @return void */ public function setPreviewData($data): void { @@ -163,4 +158,4 @@ public function hasDownloadableData(): bool { return false; } -} \ No newline at end of file +} diff --git a/Classes/Step/CheckPermissionsStep.php b/Classes/Step/CheckPermissionsStep.php index 2731d228..72b68cff 100644 --- a/Classes/Step/CheckPermissionsStep.php +++ b/Classes/Step/CheckPermissionsStep.php @@ -25,15 +25,11 @@ /** * This class ensure that permissions are enough to allow the import process to run. - * - * @package Cobweb\ExternalImport\Step */ class CheckPermissionsStep extends AbstractStep { /** * Checks that the current user has enough permissions to run the import process to the end. - * - * @return void */ public function run(): void { @@ -50,7 +46,7 @@ public function run(): void LocalizationUtility::translate( 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:no_rights_for_sync', 'external_import', - array($userName, $table) + [$userName, $table] ) ); } @@ -65,4 +61,4 @@ protected function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } -} \ No newline at end of file +} diff --git a/Classes/Step/ClearCacheStep.php b/Classes/Step/ClearCacheStep.php index 6833c4f7..5ea3a834 100644 --- a/Classes/Step/ClearCacheStep.php +++ b/Classes/Step/ClearCacheStep.php @@ -22,16 +22,11 @@ /** * Handles cache clearing operations. - * - * @package Cobweb\ExternalImport\Step */ class ClearCacheStep extends AbstractStep { - /** * Performs whatever cache clearing has been defined. - * - * @return void */ public function run(): void { @@ -39,7 +34,7 @@ public function run(): void if (empty($configuration['clearCache'])) { $this->importer->setPreviewData( [ - 'caches' => [] + 'caches' => [], ] ); } else { @@ -51,7 +46,7 @@ public function run(): void ); $this->importer->setPreviewData( [ - 'caches' => $caches + 'caches' => $caches, ] ); // Use DataHandler to clear the designated caches, if not in preview mode @@ -66,4 +61,4 @@ public function run(): void unset($tce); } } -} \ No newline at end of file +} diff --git a/Classes/Step/ConnectorCallbackStep.php b/Classes/Step/ConnectorCallbackStep.php index a3424332..377cca50 100644 --- a/Classes/Step/ConnectorCallbackStep.php +++ b/Classes/Step/ConnectorCallbackStep.php @@ -21,12 +21,11 @@ /** * Calls on the Connector at the end of the synchronize process. - * - * @package Cobweb\ExternalImport\Step */ class ConnectorCallbackStep extends AbstractStep { - public function __construct() { + public function __construct() + { $this->setExecuteDespiteAbort(true); } @@ -34,8 +33,6 @@ public function __construct() { * Evaluates a rough error status and calls back the connector. * * NOTE: this step does absolutely nothing with the data. - * - * @return void */ public function run(): void { @@ -52,4 +49,4 @@ public function run(): void ); } } -} \ No newline at end of file +} diff --git a/Classes/Step/HandleDataStep.php b/Classes/Step/HandleDataStep.php index 80ad72f2..955cea7b 100644 --- a/Classes/Step/HandleDataStep.php +++ b/Classes/Step/HandleDataStep.php @@ -26,16 +26,11 @@ /** * This step takes the raw data from the "read" step and makes it into a structured * array, ready for further processing. - * - * @package Cobweb\ExternalImport\Step */ class HandleDataStep extends AbstractStep { - /** * Maps the external data to TCA fields. - * - * @return void */ public function run(): void { @@ -56,7 +51,7 @@ public function run(): void LocalizationUtility::translate( 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:invalidCustomHandler', 'external_import', - array($generalConfiguration['dataHandler']) + [$generalConfiguration['dataHandler']] ); return; } @@ -65,7 +60,7 @@ public function run(): void LocalizationUtility::translate( 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:wrongCustomHandler', 'external_import', - array($generalConfiguration['dataHandler']) + [$generalConfiguration['dataHandler']] ); return; } @@ -88,7 +83,7 @@ public function run(): void ); break; - // This should really not happen + // This should really not happen default: $records = $originalData; break; @@ -109,4 +104,4 @@ public function hasDownloadableData(): bool { return true; } -} \ No newline at end of file +} diff --git a/Classes/Step/ReadDataStep.php b/Classes/Step/ReadDataStep.php index 982ae6d7..20bd86a1 100644 --- a/Classes/Step/ReadDataStep.php +++ b/Classes/Step/ReadDataStep.php @@ -25,8 +25,6 @@ /** * This step reads the data from the external source. - * - * @package Cobweb\ExternalImport\Step */ class ReadDataStep extends AbstractStep { @@ -41,8 +39,6 @@ public function __construct(ConnectorRegistry $connectorRegistry, EventDispatche /** * Reads the data from the external source. - * - * @return void */ public function run(): void { @@ -107,7 +103,7 @@ public function run(): void 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:data_not_fetched_connector_error', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ) ); @@ -124,14 +120,14 @@ public function run(): void 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:data_not_fetched_connector_error', 'external_import', [ - $e->getMessage() + $e->getMessage(), ] ) ); } break; - // If the data type is not defined, issue error and abort process + // If the data type is not defined, issue error and abort process default: $this->abortFlag = true; $this->importer->addMessage( @@ -166,4 +162,4 @@ protected function processParameters(array $parameters): array ); return $event->getParameters(); } -} \ No newline at end of file +} diff --git a/Classes/Step/ReportStep.php b/Classes/Step/ReportStep.php index 2a8f77f3..077ecdf6 100644 --- a/Classes/Step/ReportStep.php +++ b/Classes/Step/ReportStep.php @@ -50,4 +50,4 @@ public function run(): void ); } } -} \ No newline at end of file +} diff --git a/Classes/Step/StoreDataStep.php b/Classes/Step/StoreDataStep.php index 5a8f2004..5e3c822b 100644 --- a/Classes/Step/StoreDataStep.php +++ b/Classes/Step/StoreDataStep.php @@ -98,7 +98,6 @@ public function setImporter(Importer $importer): void /** * Stores the data to the database using DataHandler. * - * @return void * @throws \Cobweb\ExternalImport\Exception\MissingConfigurationException * @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\Driver\Exception @@ -124,13 +123,13 @@ public function run(): void $moves = 0; $updatedUids = []; $tceData = [ - $mainTable => [] + $mainTable => [], ]; $tceCommands = [ - $mainTable => [] + $mainTable => [], ]; $storedRecords = [ - $mainTable => [] + $mainTable => [], ]; // Prepare some data before the loop @@ -241,7 +240,7 @@ public function run(): void // Check if some records have a changed "pid", in which case a "move" action is also needed if (array_key_exists('pid', $theRecord) && (int)$theRecord['pid'] !== $currentPids[$externalUid]) { $tceCommands[$mainTable][$id] = [ - 'move' => (int)$theRecord['pid'] + 'move' => (int)$theRecord['pid'], ]; $moves++; } @@ -413,11 +412,11 @@ public function run(): void // Register all child records marked for deletion foreach ($this->childRecordsToDelete as $childTable => $childList) { $tceDeleteCommands = [ - $childTable => [] + $childTable => [], ]; foreach ($childList as $child) { $tceDeleteCommands[$childTable][$child] = [ - 'delete' => 1 + 'delete' => 1, ]; $deletes++; } @@ -455,7 +454,7 @@ public function run(): void $tceDeleteCommands[$mainTable] = []; foreach ($absentUids as $id) { $tceDeleteCommands[$mainTable][$id] = [ - 'delete' => 1 + 'delete' => 1, ]; $deletes++; } @@ -579,7 +578,7 @@ public function run(): void [ 'data' => $tceData, 'commands-delete' => $tceDeleteCommands ?? [], - 'commands-move' => $tceCommands + 'commands-move' => $tceCommands, ] ); @@ -671,7 +670,7 @@ public function prepareDataToStore(): array // The values that are excluded are temporarily stored for later restoration if (array_key_exists(Configuration::DO_NOT_SAVE_KEY, $configuration) && array_key_exists($name, $record)) { $this->valuesExcludedFromSaving[$id][$name] = $record[$name]; - // Make sure a value actually exists + // Make sure a value actually exists } elseif (array_key_exists($name, $record)) { // Skip the value if it is null and the column does not accept null as a valid value if ($record[$name] === null && !in_array($name, $nullableColumns, true)) { @@ -700,7 +699,7 @@ public function prepareDataToStore(): array if (isset($denormalizedSorting[$name])) { $multipleEntry = [ 'value' => $record[$name], - 'sorting' => $record[$denormalizedSorting[$name]] + 'sorting' => $record[$denormalizedSorting[$name]], ]; } else { $multipleEntry = $record[$name]; @@ -801,7 +800,7 @@ public function prepareChildStructure(string $childTable, array $childConfigurat // NOTE: all child records are assembled here as if they were new. They are filtered later on. $temporaryKey = $this->importer->getTemporaryKeyRepository()->generateTemporaryKey(); $childStructure = [ - $temporaryKey => [] + $temporaryKey => [], ]; foreach ($childConfiguration as $name => $configuration) { // If it is a value, use it as is @@ -840,7 +839,6 @@ public function prepareChildStructure(string $childTable, array $childConfigurat * @param array $parentData * @param string $childTable * @param array $childConfiguration - * @return void */ public function assembleChildrenDeletionInformation(string $parentColumn, array $controlColumnsForDelete, int $parentId, array $parentData, string $childTable, array $childConfiguration): void { @@ -859,8 +857,8 @@ public function assembleChildrenDeletionInformation(string $parentColumn, array if (isset($configuration['value'])) { $this->childrenReferenceValues[$parentId][$parentColumn][$childTable][$name] = $configuration['value']; - // If it is a field, get the value from the field, if defined - // (if it's the special value "__parent.id__", use the parent record's id) + // If it is a field, get the value from the field, if defined + // (if it's the special value "__parent.id__", use the parent record's id) } elseif (isset($configuration['field'])) { if ($configuration['field'] === '__parent.id__') { $this->childrenReferenceValues[$parentId][$parentColumn][$childTable][$name] = $parentId; @@ -909,8 +907,8 @@ public function reviewChildRecords(array $dataToStore): array // If deletion is allowed, grab existing records // (this is done once, but we need the data from one child record) if ($iterator === 0 && $childColumnConfiguration->isDeleteAllowed() && count( - $childColumnConfiguration->getControlColumnsForDelete() - ) > 0) { + $childColumnConfiguration->getControlColumnsForDelete() + ) > 0) { $allExistingChildren = $childrenRepository->findAllExistingRecords( $childTable, $this->childrenReferenceValues[$id][$column][$childTable] @@ -957,9 +955,9 @@ public function reviewChildRecords(array $dataToStore): array $newDataToStore[$id]['__children__'][$column][$childTable][$childId] = $childData; } } - // If a control value was missing, let the record be considered to be new (if inserts are allowed) - // This will probably create a database error at a later point, but the user - // will get to see it in the logs + // If a control value was missing, let the record be considered to be new (if inserts are allowed) + // This will probably create a database error at a later point, but the user + // will get to see it in the logs } elseif ($childColumnConfiguration->isInsertAllowed()) { $newDataToStore[$id]['__children__'][$column][$childTable][$childId] = $childData; } @@ -978,7 +976,6 @@ public function reviewChildRecords(array $dataToStore): array } } } - } // Loop on all children columns which were not checked in order to delete children that don't exist any more // Children columns are not checked either when the record has no children at all, or may have children in @@ -1011,7 +1008,6 @@ public function reviewChildRecords(array $dataToStore): array * that we are retrieving the right messages, not to decipher their meaning. * * @param array $errorLog - * @return void * @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\Driver\Exception */ @@ -1049,9 +1045,9 @@ protected function reportTceErrors(array $errorLog): void // Check if there's a label for the message $labelCode = 'msg_' . $row['type'] . '_' . $row['action'] . '_' . $row['details_nr']; // If not, use details field - $dataArray = json_decode( $row['log_data'], true); + $dataArray = json_decode($row['log_data'], true); if ($dataArray !== null) { - $dataArray = json_decode( $row['log_data'], true); + $dataArray = json_decode($row['log_data'], true); $label = LocalizationUtility::translate( 'LLL:EXT:belog/Resources/Private/Language/locallang.xlf:' . $labelCode, 'belog', @@ -1178,7 +1174,6 @@ public function updateSlugs(string $table, array $uids): void * Handles exceptions that happen when using the DataHandler to execute data or command structures. * * @param \Exception $e - * @return void */ protected function handleTceException(\Exception $e): void { @@ -1193,7 +1188,7 @@ protected function handleTceException(\Exception $e): void $e->getMessage(), $e->getCode(), $e->getFile(), - $e->getLine() + $e->getLine(), ] ) ); @@ -1206,7 +1201,7 @@ protected function handleTceException(\Exception $e): void ), 3, [ - $e->getTraceAsString() + $e->getTraceAsString(), ] ); } diff --git a/Classes/Step/TransformDataStep.php b/Classes/Step/TransformDataStep.php index daa6ae58..e646b393 100644 --- a/Classes/Step/TransformDataStep.php +++ b/Classes/Step/TransformDataStep.php @@ -20,8 +20,8 @@ use Cobweb\ExternalImport\Exception\CriticalFailureException; use Cobweb\ExternalImport\Exception\InvalidRecordException; use Cobweb\ExternalImport\Importer; -use Cobweb\ExternalImport\Utility\MappingUtility; use Cobweb\ExternalImport\ImporterAwareInterface; +use Cobweb\ExternalImport\Utility\MappingUtility; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; @@ -30,8 +30,6 @@ * This step takes the structured data and transforms the values it contains according to whatever * relevant properties were defined, bringing the data to a near final state, ready for saving * to the database. - * - * @package Cobweb\ExternalImport\Step */ class TransformDataStep extends AbstractStep { @@ -69,8 +67,6 @@ public function setImporter(Importer $importer): void /** * Applies all transformation properties to the existing data set, like mapping to foreign tables, * forcing constant values, running user-defined functions, etc. - * - * @return void */ public function run(): void { @@ -262,13 +258,13 @@ public function applyUserFunction(string $name, array $configuration, array $rec 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ), 3, [ 'user function' => $configuration, - 'record' => $record + 'record' => $record, ] ); } catch (\Exception $e) { @@ -280,13 +276,13 @@ public function applyUserFunction(string $name, array $configuration, array $rec 'external_import', [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ), 3, [ 'user function' => $configuration, - 'record' => $record + 'record' => $record, ] ); } @@ -334,10 +330,10 @@ public function applyIsEmpty(string $name, array $configuration, array $records) $configuration['expression'], $record ); - // If an exception is thrown, consider that this is equivalent to the expression being evaluated to true, - // because the main source of exceptions is when a value used in the expression is not present (hence "empty"). - // An exception could also happen because the expression's syntax is invalid. Unfortunately the Expression Language - // does not distinguish between the two scenarios. The event is logged for further inspection. + // If an exception is thrown, consider that this is equivalent to the expression being evaluated to true, + // because the main source of exceptions is when a value used in the expression is not present (hence "empty"). + // An exception could also happen because the expression's syntax is invalid. Unfortunately the Expression Language + // does not distinguish between the two scenarios. The event is logged for further inspection. } catch (\Exception $e) { $isEmpty = true; $this->importer->debug( @@ -367,12 +363,12 @@ public function applyIsEmpty(string $name, array $configuration, array $records) 'external_import', [ $index, - $name + $name, ] ), 3, [ - 'record' => $record + 'record' => $record, ] ); } elseif (array_key_exists('default', $configuration)) { @@ -394,4 +390,4 @@ public function hasDownloadableData(): bool { return true; } -} \ No newline at end of file +} diff --git a/Classes/Step/ValidateConfigurationStep.php b/Classes/Step/ValidateConfigurationStep.php index 1115757b..65430852 100644 --- a/Classes/Step/ValidateConfigurationStep.php +++ b/Classes/Step/ValidateConfigurationStep.php @@ -23,8 +23,6 @@ /** * Validation of the External Import configuration before starting the import process. - * - * @package Cobweb\ExternalImport\Step */ class ValidateConfigurationStep extends AbstractStep { @@ -48,8 +46,6 @@ public function __construct( /** * Validates the External Import configuration. - * - * @return void */ public function run(): void { @@ -114,4 +110,4 @@ public function run(): void $this->abortFlag = true; } } -} \ No newline at end of file +} diff --git a/Classes/Step/ValidateConnectorStep.php b/Classes/Step/ValidateConnectorStep.php index 817aa06f..3a57fb8a 100644 --- a/Classes/Step/ValidateConnectorStep.php +++ b/Classes/Step/ValidateConnectorStep.php @@ -21,16 +21,11 @@ /** * Validation of the External Import configuration specifically for synchronize processes. - * - * @package Cobweb\ExternalImport\Step */ class ValidateConnectorStep extends AbstractStep { - /** * Validates that the External Import configuration for a "synchronize" operation has a connector. - * - * @return void */ public function run(): void { @@ -45,4 +40,4 @@ public function run(): void $this->abortFlag = true; } } -} \ No newline at end of file +} diff --git a/Classes/Step/ValidateDataStep.php b/Classes/Step/ValidateDataStep.php index b431dad4..9f498f8a 100644 --- a/Classes/Step/ValidateDataStep.php +++ b/Classes/Step/ValidateDataStep.php @@ -23,15 +23,11 @@ * Validates the data after it has been mapped to TCA columns. * * This step does not transform data. It may only interrupt the process, if data does not validate. - * - * @package Cobweb\ExternalImport\Step */ class ValidateDataStep extends AbstractStep { /** * Performs the data validation. - * - * @return void */ public function run(): void { @@ -48,13 +44,13 @@ public function run(): void LocalizationUtility::translate( 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:notEnoughRecords', 'external_import', - array( + [ $countRecords, - $generalConfiguration['minimumRecords'] - ) + $generalConfiguration['minimumRecords'], + ] ) ); } } } -} \ No newline at end of file +} diff --git a/Classes/Task/AutomatedSyncAdditionalFieldProvider.php b/Classes/Task/AutomatedSyncAdditionalFieldProvider.php index b2d963df..518816fa 100644 --- a/Classes/Task/AutomatedSyncAdditionalFieldProvider.php +++ b/Classes/Task/AutomatedSyncAdditionalFieldProvider.php @@ -27,8 +27,6 @@ /** * Additional fields provider class for the Scheduler. - * - * @package Cobweb\ExternalImport\Task */ class AutomatedSyncAdditionalFieldProvider implements AdditionalFieldProviderInterface { @@ -126,7 +124,7 @@ public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleCont 'code' => $fieldCode, 'label' => 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:field.syncItem', 'cshKey' => '_MOD_user_txexternalimportM1', - 'cshLabel' => $fieldID + 'cshLabel' => $fieldID, ]; // Add field for storage page override @@ -168,7 +166,6 @@ public function validateAdditionalFields(array &$submittedData, SchedulerModuleC * * @param array $submittedData Array containing the data submitted by the user * @param AbstractTask $task Reference to the current task object - * @return void */ public function saveAdditionalFields(array $submittedData, AbstractTask $task): void { diff --git a/Classes/Task/AutomatedSyncTask.php b/Classes/Task/AutomatedSyncTask.php index 79cf4a0e..10ec9944 100644 --- a/Classes/Task/AutomatedSyncTask.php +++ b/Classes/Task/AutomatedSyncTask.php @@ -27,8 +27,6 @@ /** * This class executes Scheduler events for automatic synchronisations of external data - * - * @package Cobweb\ExternalImport\Task */ class AutomatedSyncTask extends AbstractTask { diff --git a/Classes/Transformation/DateTimeTransformation.php b/Classes/Transformation/DateTimeTransformation.php index ab70aac9..18a7bdef 100644 --- a/Classes/Transformation/DateTimeTransformation.php +++ b/Classes/Transformation/DateTimeTransformation.php @@ -23,8 +23,6 @@ /** * Example transformation functions for the 'external_import' extension - * - * @package Cobweb\ExternalImport\Transformation */ class DateTimeTransformation implements SingletonInterface, ImporterAwareInterface { diff --git a/Classes/Transformation/ImageTransformation.php b/Classes/Transformation/ImageTransformation.php index c8c3b996..9a67e0f1 100644 --- a/Classes/Transformation/ImageTransformation.php +++ b/Classes/Transformation/ImageTransformation.php @@ -29,8 +29,6 @@ * during an import process. Use as is or as an inspiration for your own needs. * * The critical part is that the function is expected to return the uid of a sys_file record. - * - * @package Cobweb\ExternalImport\Transformation */ class ImageTransformation implements SingletonInterface, ImporterAwareInterface { diff --git a/Classes/UserFunction/ConfigurationItems.php b/Classes/UserFunction/ConfigurationItems.php index a2c2c632..dfc6bfcb 100644 --- a/Classes/UserFunction/ConfigurationItems.php +++ b/Classes/UserFunction/ConfigurationItems.php @@ -59,4 +59,4 @@ public function listConfigurationItems(array &$parameters): void ]; } } -} \ No newline at end of file +} diff --git a/Classes/Utility/ChildrenSortingUtility.php b/Classes/Utility/ChildrenSortingUtility.php index 3dbc0ea3..bd0be952 100644 --- a/Classes/Utility/ChildrenSortingUtility.php +++ b/Classes/Utility/ChildrenSortingUtility.php @@ -42,7 +42,6 @@ public function __construct(Importer $importer) * Executes the sorting of the child records based on the given sorting information * * @param ChildrenSorting $sortingInformation - * @return void */ public function sortChildRecords(ChildrenSorting $sortingInformation): void { @@ -84,7 +83,6 @@ public function sortChildRecords(ChildrenSorting $sortingInformation): void * @param string $table Name of the affected table * @param string $field Name of the sorting field * @param array $sorting List of records to update (uid - value pairs) - * @return void */ protected function updateChildrenSortingField(string $table, string $field, array $sorting): void { @@ -110,4 +108,4 @@ protected function updateChildrenSortingField(string $table, string $field, arra } } } -} \ No newline at end of file +} diff --git a/Classes/Utility/CompatibilityUtility.php b/Classes/Utility/CompatibilityUtility.php index 689b9c0f..1357c672 100644 --- a/Classes/Utility/CompatibilityUtility.php +++ b/Classes/Utility/CompatibilityUtility.php @@ -22,8 +22,6 @@ /** * Small class for encapsulating methods related to backwards-compatibility. - * - * @package Cobweb\ExternalImport\Utility */ class CompatibilityUtility { @@ -48,4 +46,4 @@ public static function isV12(): bool $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); return $typo3Version->getMajorVersion() === 12; } -} \ No newline at end of file +} diff --git a/Classes/Utility/CsvUtility.php b/Classes/Utility/CsvUtility.php index d83f5e8e..afc22f6f 100644 --- a/Classes/Utility/CsvUtility.php +++ b/Classes/Utility/CsvUtility.php @@ -77,4 +77,4 @@ public function ensureCompleteStructure(array $array): array } return $restructuredRecords; } -} \ No newline at end of file +} diff --git a/Classes/Utility/DebugUtility.php b/Classes/Utility/DebugUtility.php index b88ffb59..2b187602 100644 --- a/Classes/Utility/DebugUtility.php +++ b/Classes/Utility/DebugUtility.php @@ -19,8 +19,6 @@ /** * Class with some utilities for dumping an array as a HTML table. - * - * @package Cobweb\ExternalImport\Utility */ class DebugUtility { @@ -70,7 +68,7 @@ public static function dumpTwinArrays(array $referenceArray, array $copyArray): if (is_array($value)) { $table .= self::dumpTwinArrays( $value, - array_key_exists($key, $copyArray) ? $copyArray[$key] : array() + array_key_exists($key, $copyArray) ? $copyArray[$key] : [] ); } else { $cellContent = htmlspecialchars((string)$value); @@ -86,5 +84,4 @@ public static function dumpTwinArrays(array $referenceArray, array $copyArray): $table .= ''; return $table; } - -} \ No newline at end of file +} diff --git a/Classes/Utility/MappingUtility.php b/Classes/Utility/MappingUtility.php index 40de5b34..02ffa5f8 100644 --- a/Classes/Utility/MappingUtility.php +++ b/Classes/Utility/MappingUtility.php @@ -25,8 +25,6 @@ /** * Tools for mapping imported data to existing database relations. - * - * @package Cobweb\ExternalImport\Utility */ class MappingUtility implements ImporterAwareInterface { @@ -271,4 +269,4 @@ public function matchSingleField($externalValue, array $mappingInformation, arra } return $returnValue; } -} \ No newline at end of file +} diff --git a/Classes/Utility/ReportingUtility.php b/Classes/Utility/ReportingUtility.php index 0a7a7466..c4073df6 100644 --- a/Classes/Utility/ReportingUtility.php +++ b/Classes/Utility/ReportingUtility.php @@ -33,8 +33,6 @@ /** * This class performs various reporting actions after a data import has taken place. - * - * @package Cobweb\ExternalImport\Utility */ class ReportingUtility implements LoggerAwareInterface { @@ -72,7 +70,6 @@ public function __construct(LogRepository $logRepository, Context $context, Back * Sets a back-reference to the Importer object. * * @param Importer $importer - * @return void */ public function setImporter(Importer $importer): void { @@ -83,7 +80,6 @@ public function setImporter(Importer $importer): void /** * Stores the messages to the external_import log. * - * @return void * @throws AspectNotFoundException */ public function writeToLog(): void @@ -147,20 +143,20 @@ public function reportForTable(string $table, $index, array $messages): string { $languageObject = $this->getLanguageObject(); $report = sprintf( - $languageObject->sL( - 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:synchronizeTableX' - ), - $table, - $index - ) . "\n"; + $languageObject->sL( + 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:synchronizeTableX' + ), + $table, + $index + ) . "\n"; foreach ($messages as $type => $messageList) { $report .= $languageObject->sL( - 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:label.' . $type - ) . "\n"; + 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:label.' . $type + ) . "\n"; if (count($messageList) === 0) { $report .= "\t" . $languageObject->sL( - 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:no.' . $type - ) . "\n"; + 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:no.' . $type + ) . "\n"; } else { foreach ($messageList as $aMessage) { $report .= "\t- " . $aMessage . "\n"; @@ -176,7 +172,6 @@ public function reportForTable(string $table, $index, array $messages): string * * @param string $subject Subject of the mail * @param string $body Text body of the mail - * @return void */ public function sendMail(string $subject, string $body): void { @@ -198,7 +193,7 @@ public function sendMail(string $subject, string $body): void $mailObject = GeneralUtility::makeInstance(MailMessage::class); try { $sender = [ - $senderMail => $senderName + $senderMail => $senderName, ]; $mailObject->setFrom($sender); $mailObject->setReplyTo($sender); @@ -229,7 +224,6 @@ public function sendMail(string $subject, string $body): void * @param string $step Name of the step (class) * @param string $key Name of the key * @param mixed $value Value to store - * @return void */ public function setValueForStep(string $step, string $key, $value): void { @@ -259,7 +253,6 @@ public function getValueForStep(string $step, string $key) $key ), 1530635849 - ); } diff --git a/Classes/Utility/SlugUtility.php b/Classes/Utility/SlugUtility.php index 759b3906..a35c61ca 100644 --- a/Classes/Utility/SlugUtility.php +++ b/Classes/Utility/SlugUtility.php @@ -29,8 +29,6 @@ * * NOTE: I know I have taken parts of this code from somewhere, but I don't remember where. * If you recognize your baby, please raise you hand so that I can duly credit you. - * - * @package Cobweb\ExternalImport\Utility */ class SlugUtility { @@ -186,4 +184,4 @@ function (array $settings) { ) ); } -} \ No newline at end of file +} diff --git a/Classes/Utility/StepUtility.php b/Classes/Utility/StepUtility.php index 1cfc6bba..3a7e8d2f 100644 --- a/Classes/Utility/StepUtility.php +++ b/Classes/Utility/StepUtility.php @@ -23,8 +23,6 @@ /** * Manages the insertion of custom steps into the steps array. - * - * @package Cobweb\ExternalImport\Utility */ class StepUtility { @@ -167,10 +165,10 @@ public function validateCustomStepConfiguration(array $currentSteps, array $conf } // If everything passed, return validated configuration - return array( + return [ 'class' => $stepClass, 'position' => $position, - 'reference' => $class - ); + 'reference' => $class, + ]; } -} \ No newline at end of file +} diff --git a/Classes/Validator/ColumnConfigurationValidator.php b/Classes/Validator/ColumnConfigurationValidator.php index 1bc8ccd2..19ec9656 100644 --- a/Classes/Validator/ColumnConfigurationValidator.php +++ b/Classes/Validator/ColumnConfigurationValidator.php @@ -27,8 +27,6 @@ * and reports errors and other glitches. * * NOTE: this is not a strict Extbase Validator. - * - * @package Cobweb\ExternalImport\Validator */ class ColumnConfigurationValidator { @@ -46,7 +44,7 @@ class ColumnConfigurationValidator 'attribute', 'attributeNS', 'xpath', - 'xmlValue' + 'xmlValue', ]; /** @@ -259,7 +257,7 @@ public function validateChildrenProperty($childrenConfiguration): void 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:childrenProperyControlColumnsForUpdateContainsInvalidColumns', 'external_import', [ - implode(', ', $missingColumns) + implode(', ', $missingColumns), ] ), AbstractMessage::ERROR @@ -297,7 +295,7 @@ public function validateChildrenProperty($childrenConfiguration): void 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:childrenProperyControlColumnsForDeleteContainsInvalidColumns', 'external_import', [ - implode(', ', $missingColumns) + implode(', ', $missingColumns), ] ), AbstractMessage::ERROR @@ -352,7 +350,7 @@ public function validateSubstructureFieldsProperty(array $generalConfiguration, 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:substructureFieldsPropertyNotAnArrayForField', 'external_import', [ - $field + $field, ] ), AbstractMessage::ERROR @@ -370,7 +368,7 @@ public function validateSubstructureFieldsProperty(array $generalConfiguration, 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:substructureFieldsPropertyWithEmptyConfigurationForArrayTypeData', 'external_import', [ - $field + $field, ] ), AbstractMessage::ERROR @@ -387,7 +385,7 @@ public function validateSubstructureFieldsProperty(array $generalConfiguration, 'external_import', [ implode(', ', $wrongKeys), - implode(', ', self::$substructurePropertiesForArrayType) + implode(', ', self::$substructurePropertiesForArrayType), ] ), AbstractMessage::ERROR @@ -410,7 +408,7 @@ public function validateSubstructureFieldsProperty(array $generalConfiguration, 'external_import', [ implode(', ', $wrongKeys), - implode(', ', self::$substructurePropertiesForXmlType) + implode(', ', self::$substructurePropertiesForXmlType), ] ), AbstractMessage::ERROR @@ -451,5 +449,4 @@ public function getResults(): ValidationResult { return $this->results; } - -} \ No newline at end of file +} diff --git a/Classes/Validator/FrequencyValidator.php b/Classes/Validator/FrequencyValidator.php index 88b87232..bde8997c 100644 --- a/Classes/Validator/FrequencyValidator.php +++ b/Classes/Validator/FrequencyValidator.php @@ -24,8 +24,6 @@ /** * Validator for a scheduler frequency, which can be a simple number of seconds * or a cron format. - * - * @package Cobweb\ExternalImport\Validator */ class FrequencyValidator extends AbstractValidator { @@ -41,7 +39,6 @@ class FrequencyValidator extends AbstractValidator * Validates the frequency as a number of seconds or a cron syntax. * * @param string $value The frequency to validate - * @return void */ public function isValid($value): void { @@ -69,13 +66,13 @@ public function isValid($value): void LocalizationUtility::translate( 'error_wrong_frequency', 'external_import', - array( - $e->getMessage() - ) + [ + $e->getMessage(), + ] ), 1463495019 ); } } } -} \ No newline at end of file +} diff --git a/Classes/Validator/GeneralConfigurationValidator.php b/Classes/Validator/GeneralConfigurationValidator.php index 76dce21b..73b90a1e 100644 --- a/Classes/Validator/GeneralConfigurationValidator.php +++ b/Classes/Validator/GeneralConfigurationValidator.php @@ -21,7 +21,6 @@ use Cobweb\ExternalImport\Domain\Model\Configuration; use Cobweb\ExternalImport\Exception\InvalidCustomStepConfiguration; use Cobweb\ExternalImport\Importer; -use Cobweb\ExternalImport\Utility\CompatibilityUtility; use Cobweb\ExternalImport\Utility\StepUtility; use Cobweb\Svconnector\Registry\ConnectorRegistry; use TYPO3\CMS\Core\Messaging\AbstractMessage; @@ -33,8 +32,6 @@ * and reports errors and other glitches. * * NOTE: this is not a strict Extbase Validator. - * - * @package Cobweb\ExternalImport\Validator */ class GeneralConfigurationValidator { @@ -119,7 +116,6 @@ public function isValid(Configuration $configuration): bool * Validates the "data" property. * * @param string $property Property value - * @return void */ public function validateDataProperty(string $property): void { @@ -149,7 +145,6 @@ public function validateDataProperty(string $property): void * (of course, this may be wrong, but we have no way to guess the user's intent ;-) ). * * @param string $property Property value - * @return void */ public function validateConnectorProperty(string $property): void { @@ -176,7 +171,6 @@ public function validateConnectorProperty(string $property): void * * @param string $connector Type of connector * @param array $property Parameters for the connector - * @return void * @see \Cobweb\ExternalImport\Validator\GeneralConfigurationValidator::validateConnectorProperty */ public function validateConnectorConfigurationProperty(string $connector, array $property): void @@ -203,7 +197,6 @@ public function validateConnectorConfigurationProperty(string $connector, array * Validates the "dataHandler" property. * * @param string|null $property Property value - * @return void */ public function validateDataHandlerProperty(?string $property): void { @@ -246,7 +239,6 @@ public function validateDataHandlerProperty(?string $property): void * * @param string $nodetype Nodetype property value * @param string $nodepath Nodepath property value - * @return void */ public function validateNodeProperty(string $nodetype = '', string $nodepath = ''): void { @@ -266,7 +258,6 @@ public function validateNodeProperty(string $nodetype = '', string $nodepath = ' * Validates the "referenceUid" property. * * @param string $property Property value - * @return void */ public function validateReferenceUidProperty(string $property): void { @@ -285,7 +276,6 @@ public function validateReferenceUidProperty(string $property): void * Validates the "priority" property. * * @param int $property Property value - * @return void */ public function validatePriorityProperty(int $property): void { @@ -296,7 +286,7 @@ public function validatePriorityProperty(int $property): void 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:defaultPriorityValue', null, [ - Importer::DEFAULT_PRIORITY + Importer::DEFAULT_PRIORITY, ] ), AbstractMessage::NOTICE @@ -308,7 +298,6 @@ public function validatePriorityProperty(int $property): void * Validates the "pid" property. * * @param mixed $property Property value - * @return void */ public function validatePidProperty($property): void { @@ -336,7 +325,7 @@ public function validatePidProperty($property): void 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:pidNotSetStoreRootPageNotAllowed', null, [ - $this->table + $this->table, ] ), AbstractMessage::ERROR @@ -360,7 +349,7 @@ public function validatePidProperty($property): void 'LLL:EXT:external_import/Resources/Private/Language/Validator.xlf:invalidPidPropertyOnlyRoot', null, [ - $this->table + $this->table, ] ), AbstractMessage::ERROR @@ -373,7 +362,6 @@ public function validatePidProperty($property): void * * @param mixed $property Property value * @param array $columns List of column configurations - * @return void */ public function validateUseColumnIndexProperty($property, array $columns): void { @@ -387,7 +375,7 @@ public function validateUseColumnIndexProperty($property, array $columns): void null, [ $property, - $this->table + $this->table, ] ), AbstractMessage::ERROR @@ -400,7 +388,6 @@ public function validateUseColumnIndexProperty($property, array $columns): void * * @param mixed $property Property value * @param array $columns List of column configurations - * @return void */ public function validateColumnsOrderProperty(string $property, array $columns): void { @@ -448,7 +435,6 @@ public function validateColumnsOrderProperty(string $property, array $columns): * * @param array|null $property Property value * @param array $ctrlConfiguration Full "ctrl" configuration - * @return void */ public function validateCustomStepsProperty(?array $property, array $ctrlConfiguration): void { @@ -471,7 +457,7 @@ public function validateCustomStepsProperty(?array $property, array $ctrlConfigu null, [ $e->getMessage(), - $e->getCode() + $e->getCode(), ] ), AbstractMessage::NOTICE @@ -491,4 +477,4 @@ public function getResults(): ValidationResult { return $this->results; } -} \ No newline at end of file +} diff --git a/Classes/Validator/ValidationResult.php b/Classes/Validator/ValidationResult.php index bb546bf3..88269589 100644 --- a/Classes/Validator/ValidationResult.php +++ b/Classes/Validator/ValidationResult.php @@ -21,8 +21,6 @@ /** * Utility class used to store validation results. - * - * @package Cobweb\ExternalImport\Validator */ class ValidationResult { @@ -33,8 +31,6 @@ class ValidationResult /** * Resets the list of results. - * - * @return void */ public function reset(): void { @@ -47,7 +43,6 @@ public function reset(): void * @param string $property * @param string $message * @param int $severity - * @return void */ public function add(string $property, string $message, int $severity = AbstractMessage::WARNING): void { @@ -56,7 +51,7 @@ public function add(string $property, string $message, int $severity = AbstractM } $this->results[$property][] = [ 'severity' => $severity, - 'message' => $message + 'message' => $message, ]; } @@ -167,7 +162,7 @@ public function sortResults(): void $results, [ self::class, - 'compareSeverity' + 'compareSeverity', ] ); $this->results[$property] = $results; @@ -194,4 +189,4 @@ public static function compareSeverity(array $a, array $b): int } return 0; } -} \ No newline at end of file +} diff --git a/Classes/ViewHelpers/Be/TableTitleViewHelper.php b/Classes/ViewHelpers/Be/TableTitleViewHelper.php index 9bcec872..1fdb682a 100644 --- a/Classes/ViewHelpers/Be/TableTitleViewHelper.php +++ b/Classes/ViewHelpers/Be/TableTitleViewHelper.php @@ -23,16 +23,11 @@ /** * Returns the name of a table, as per its TCA definition - * - * @package Cobweb\ExternalImport\ViewHelpers\Be */ class TableTitleViewHelper extends AbstractViewHelper { - /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { diff --git a/Classes/ViewHelpers/DisplayValidationResultViewHelper.php b/Classes/ViewHelpers/DisplayValidationResultViewHelper.php index 23901a9c..b761699d 100644 --- a/Classes/ViewHelpers/DisplayValidationResultViewHelper.php +++ b/Classes/ViewHelpers/DisplayValidationResultViewHelper.php @@ -23,8 +23,6 @@ /** * Displays the validation result for the current property. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class DisplayValidationResultViewHelper extends AbstractViewHelper { @@ -37,8 +35,6 @@ class DisplayValidationResultViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { @@ -63,7 +59,7 @@ public static function renderStatic( AbstractMessage::INFO => 'alert-info', AbstractMessage::NOTICE => 'alert-notice', AbstractMessage::WARNING => 'alert-warning', - AbstractMessage::ERROR => 'alert-danger' + AbstractMessage::ERROR => 'alert-danger', ]; $message = '
'; $output = ''; @@ -78,4 +74,4 @@ public static function renderStatic( } return $output; } -} \ No newline at end of file +} diff --git a/Classes/ViewHelpers/DumpViewHelper.php b/Classes/ViewHelpers/DumpViewHelper.php index c8bf2440..4f630b39 100644 --- a/Classes/ViewHelpers/DumpViewHelper.php +++ b/Classes/ViewHelpers/DumpViewHelper.php @@ -23,8 +23,6 @@ /** * Dumps an array in a formatted way. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class DumpViewHelper extends AbstractViewHelper { @@ -37,8 +35,6 @@ class DumpViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { diff --git a/Classes/ViewHelpers/ProcessedParametersViewHelper.php b/Classes/ViewHelpers/ProcessedParametersViewHelper.php index d7ab5b6a..3388bf8c 100644 --- a/Classes/ViewHelpers/ProcessedParametersViewHelper.php +++ b/Classes/ViewHelpers/ProcessedParametersViewHelper.php @@ -27,8 +27,6 @@ /** * Processes the connector parameters of an external import configuration * and makes them available variable. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class ProcessedParametersViewHelper extends AbstractViewHelper { @@ -41,8 +39,6 @@ class ProcessedParametersViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { @@ -84,5 +80,4 @@ public static function renderStatic( return $output; } - } diff --git a/Classes/ViewHelpers/TwinDumpViewHelper.php b/Classes/ViewHelpers/TwinDumpViewHelper.php index cb9a7a03..37c1578d 100644 --- a/Classes/ViewHelpers/TwinDumpViewHelper.php +++ b/Classes/ViewHelpers/TwinDumpViewHelper.php @@ -23,8 +23,6 @@ /** * Dumps an array in a formatted way, comparing it with a second, modified array. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class TwinDumpViewHelper extends AbstractViewHelper { @@ -37,8 +35,6 @@ class TwinDumpViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { diff --git a/Classes/ViewHelpers/ValidateColumnConfigurationViewHelper.php b/Classes/ViewHelpers/ValidateColumnConfigurationViewHelper.php index b274b135..84a4d3e0 100644 --- a/Classes/ViewHelpers/ValidateColumnConfigurationViewHelper.php +++ b/Classes/ViewHelpers/ValidateColumnConfigurationViewHelper.php @@ -25,8 +25,6 @@ /** * Validates the "column" part of a configuration and loads the validation results as a container variable. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class ValidateColumnConfigurationViewHelper extends AbstractViewHelper { @@ -39,8 +37,6 @@ class ValidateColumnConfigurationViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { diff --git a/Classes/ViewHelpers/ValidateGeneralConfigurationViewHelper.php b/Classes/ViewHelpers/ValidateGeneralConfigurationViewHelper.php index b6bedf6a..c69c0957 100644 --- a/Classes/ViewHelpers/ValidateGeneralConfigurationViewHelper.php +++ b/Classes/ViewHelpers/ValidateGeneralConfigurationViewHelper.php @@ -25,8 +25,6 @@ /** * Validates the general part of a configuration and loads the validation results as a container variable. - * - * @package Cobweb\ExternalImport\ViewHelpers */ class ValidateGeneralConfigurationViewHelper extends AbstractViewHelper { @@ -39,8 +37,6 @@ class ValidateGeneralConfigurationViewHelper extends AbstractViewHelper /** * Initializes the arguments of the ViewHelper. - * - * @return void */ public function initializeArguments(): void { diff --git a/Configuration/Backend/AjaxRoutes.php b/Configuration/Backend/AjaxRoutes.php index dd428ef6..2b8ef88b 100644 --- a/Configuration/Backend/AjaxRoutes.php +++ b/Configuration/Backend/AjaxRoutes.php @@ -3,6 +3,6 @@ return [ 'tx_externalimport_loglist' => [ 'path' => '/external_import/log/get', - 'target' => \Cobweb\ExternalImport\Controller\LogAjaxController::class . '::getAction' - ] + 'target' => \Cobweb\ExternalImport\Controller\LogAjaxController::class . '::getAction', + ], ]; diff --git a/Configuration/Backend/Modules.php b/Configuration/Backend/Modules.php index 6eeba273..2324bb52 100644 --- a/Configuration/Backend/Modules.php +++ b/Configuration/Backend/Modules.php @@ -43,7 +43,7 @@ 'extensionName' => 'external_import', 'controllerActions' => [ \Cobweb\ExternalImport\Controller\LogModuleController::class => [ - 'list' + 'list', ], ], ], diff --git a/Configuration/Icons.php b/Configuration/Icons.php index 1f76ac10..8acf3bd3 100644 --- a/Configuration/Icons.php +++ b/Configuration/Icons.php @@ -3,22 +3,22 @@ return [ 'tx_externalimport-main-module' => [ 'provider' => TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:external_import/Resources/Public/Icons/MainModuleIcon.svg' + 'source' => 'EXT:external_import/Resources/Public/Icons/MainModuleIcon.svg', ], 'tx_externalimport-data-module' => [ 'provider' => TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:external_import/Resources/Public/Icons/DataModuleIcon.svg' + 'source' => 'EXT:external_import/Resources/Public/Icons/DataModuleIcon.svg', ], 'tx_externalimport-log-module' => [ 'provider' => TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:external_import/Resources/Public/Icons/LogModuleIcon.svg' + 'source' => 'EXT:external_import/Resources/Public/Icons/LogModuleIcon.svg', ], 'tx_external_import-log' => [ 'provider' => TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:external_import/Resources/Public/Icons/Log.svg' + 'source' => 'EXT:external_import/Resources/Public/Icons/Log.svg', ], 'tx_external_import-reaction-import' => [ 'provider' => TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:external_import/Resources/Public/Icons/Reaction.svg' + 'source' => 'EXT:external_import/Resources/Public/Icons/Reaction.svg', ], -]; \ No newline at end of file +]; diff --git a/Configuration/TCA/tx_externalimport_domain_model_log.php b/Configuration/TCA/tx_externalimport_domain_model_log.php index 7d4ad583..3080b29d 100644 --- a/Configuration/TCA/tx_externalimport_domain_model_log.php +++ b/Configuration/TCA/tx_externalimport_domain_model_log.php @@ -10,8 +10,8 @@ 'default_sortby' => 'ORDER BY crdate DESC', 'searchFields' => 'configuration', 'typeicon_classes' => [ - 'default' => 'tx_external_import-log' - ] + 'default' => 'tx_external_import-log', + ], ], 'columns' => [ 'status' => [ @@ -23,7 +23,7 @@ 'size' => 10, 'max' => 5, 'eval' => 'int', - ] + ], ], 'crdate' => [ 'exclude' => 0, @@ -34,7 +34,7 @@ 'renderType' => 'inputDateTime', 'size' => 20, 'eval' => 'datetime', - ] + ], ], 'cruser_id' => [ 'exclude' => 0, @@ -45,8 +45,8 @@ 'renderType' => 'selectSingle', 'size' => 1, 'foreign_table' => 'be_users', - 'maxitems' => 1 - ] + 'maxitems' => 1, + ], ], 'configuration' => [ 'exclude' => 0, @@ -54,8 +54,8 @@ 'config' => [ 'readOnly' => true, 'type' => 'input', - 'eval' => 'trim, required' - ] + 'eval' => 'trim, required', + ], ], 'context' => [ 'exclude' => 0, @@ -64,8 +64,8 @@ 'readOnly' => true, 'type' => 'input', 'max' => 50, - 'eval' => 'trim, required' - ] + 'eval' => 'trim, required', + ], ], 'message' => [ 'exclude' => 0, @@ -73,7 +73,7 @@ 'config' => [ 'readOnly' => true, 'type' => 'text', - ] + ], ], 'duration' => [ 'exclude' => 0, @@ -82,13 +82,13 @@ 'readOnly' => true, 'type' => 'input', 'max' => 20, - 'eval' => 'int' - ] - ] + 'eval' => 'int', + ], + ], ], 'types' => [ '0' => [ - 'showitem' => 'status, crdate, cruser_id, configuration, context, message, duration' - ] - ] + 'showitem' => 'status, crdate, cruser_id, configuration, context, message, duration', + ], + ], ]; diff --git a/Makefile b/Makefile index 77dab54f..94a37d8a 100644 --- a/Makefile +++ b/Makefile @@ -14,3 +14,20 @@ test-docs: ## Test the documentation rendering mkdir -p Documentation-GENERATED-temp docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log + +.PHONY: rector +rector: ## Run rector + Build/Scripts/runTests.sh -s rector + +.PHONY: fix-cs +fix-cs: ## Fix PHP coding styles + Build/Scripts/runTests.sh -s cgl + +.PHONY: phpstan +phpstan: ## Run phpstan tests + Build/Scripts/runTests.sh -s phpstan + +.PHONY: phpstan-baseline +phpstan-baseline: ## Update the phpstan baseline + Build/Scripts/runTests.sh -s phpstanBaseline + diff --git a/Tests/Functional/Domain/Repository/ConfigurationRepositoryTest.php b/Tests/Functional/Domain/Repository/ConfigurationRepositoryTest.php index f985f60b..81e60e4e 100644 --- a/Tests/Functional/Domain/Repository/ConfigurationRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/ConfigurationRepositoryTest.php @@ -26,8 +26,6 @@ /** * Test suite for the ConfigurationRepository class. - * - * @package Cobweb\ExternalImport\Tests\Domain\Repository */ class ConfigurationRepositoryTest extends FunctionalTestCase { @@ -38,7 +36,7 @@ class ConfigurationRepositoryTest extends FunctionalTestCase protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -88,12 +86,12 @@ public function syncFlagProvider(): array return [ 'sync is true' => [ true, - 16 + 16, ], 'sync is false' => [ false, - 1 - ] + 1, + ], ]; } @@ -104,7 +102,7 @@ public function findAllGroupsReturnsListOfGroups(): void { self::assertSame( [ - 'Products' + 'Products', ], $this->subject->findAllGroups() ); @@ -137,9 +135,9 @@ public function findConfigurationProvider(): array 'field' => 'code', 'transformations' => [ 10 => [ - 'trim' => true - ] - ] + 'trim' => true, + ], + ], ], 'additionalFields' => [ 'position' => [ @@ -148,13 +146,13 @@ public function findConfigurationProvider(): array 10 => [ 'userFunction' => [ 'class' => Transformation::class, - 'method' => 'stripPositionMarker' - ] - ] + 'method' => 'stripPositionMarker', + ], + ], ], - Configuration::DO_NOT_SAVE_KEY => true - ] - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], + ], ], 'configuration with useColumnIndex and no specific configuration' => [ 'table' => 'tx_externalimporttest_product', @@ -165,9 +163,9 @@ public function findConfigurationProvider(): array // since the "stable" configuration has the useColumnIndex property pointing to "base" configuration 'columnConfiguration' => [ 'xpath' => './self::*[@type="current"]/item', - 'attribute' => 'sku' + 'attribute' => 'sku', ], - 'additionalFields' => [] + 'additionalFields' => [], ], 'configuration with useColumnIndex but specific configuration' => [ 'table' => 'tx_externalimporttest_product', @@ -183,14 +181,14 @@ public function findConfigurationProvider(): array 'class' => Transformation::class, 'method' => 'caseTransformation', 'parameters' => [ - 'transformation' => 'upper' - ] - ] - ] - ] + 'transformation' => 'upper', + ], + ], + ], + ], ], - 'additionalFields' => [] - ] + 'additionalFields' => [], + ], ]; } @@ -248,51 +246,51 @@ public function findOrderedConfigurationsReturnsFullOrderedList(): void { $expectedList = [ 1000 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'general_configuration_errors', 'group' => '-'] + ['table' => 'tx_externalimporttest_product', 'index' => 'general_configuration_errors', 'group' => '-'], ], 5000 => [ - ['table' => 'tx_externalimporttest_tag', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_tag', 'index' => 0, 'group' => '-'], ], 5050 => [ ['table' => 'sys_category', 'index' => 'product_categories', 'group' => '-'], - ['table' => 'sys_category', 'index' => 'column_configuration_errors', 'group' => '-'] + ['table' => 'sys_category', 'index' => 'column_configuration_errors', 'group' => '-'], ], 5080 => [ - ['table' => 'tx_externalimporttest_designer', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_designer', 'index' => 0, 'group' => '-'], ], 5100 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'base', 'group' => 'Products'] + ['table' => 'tx_externalimporttest_product', 'index' => 'base', 'group' => 'Products'], ], 5110 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'more', 'group' => 'Products'] + ['table' => 'tx_externalimporttest_product', 'index' => 'more', 'group' => 'Products'], ], 5120 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'stable', 'group' => 'Products'] + ['table' => 'tx_externalimporttest_product', 'index' => 'stable', 'group' => 'Products'], ], 5200 => [ - ['table' => 'tx_externalimporttest_bundle', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_bundle', 'index' => 0, 'group' => '-'], ], 5300 => [ - ['table' => 'tx_externalimporttest_order', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_order', 'index' => 0, 'group' => '-'], ], 5400 => [ - ['table' => 'tx_externalimporttest_store', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_store', 'index' => 0, 'group' => '-'], ], 5410 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'products_for_stores', 'group' => '-'] + ['table' => 'tx_externalimporttest_product', 'index' => 'products_for_stores', 'group' => '-'], ], 5500 => [ - ['table' => 'tx_externalimporttest_invoice', 'index' => 0, 'group' => '-'] + ['table' => 'tx_externalimporttest_invoice', 'index' => 0, 'group' => '-'], ], 5800 => [ - ['table' => 'pages', 'index' => 'product_pages', 'group' => '-'] + ['table' => 'pages', 'index' => 'product_pages', 'group' => '-'], ], 5810 => [ - ['table' => 'tx_externalimporttest_product', 'index' => 'updated_products', 'group' => '-'] + ['table' => 'tx_externalimporttest_product', 'index' => 'updated_products', 'group' => '-'], ], 5900 => [ - ['table' => 'tx_externalimporttest_tag', 'index' => 'only-delete', 'group' => '-'] - ] + ['table' => 'tx_externalimporttest_tag', 'index' => 'only-delete', 'group' => '-'], + ], ]; self::assertSame( $expectedList, @@ -314,13 +312,13 @@ public function findByTableAndIndexReturnsExternalConfiguration(): void 'general' => [ 'connector' => 'json', 'parameters' => [ - 'uri' => 'EXT:externalimport_test/Resources/Private/ImportData/Test/Bundles.json' + 'uri' => 'EXT:externalimport_test/Resources/Private/ImportData/Test/Bundles.json', ], 'data' => 'array', 'referenceUid' => 'bundle_code', 'priority' => 5200, 'description' => 'List of bundles', - 'pid' => 0 + 'pid' => 0, ], 'additionalFields' => [ 'position' => [ @@ -329,44 +327,44 @@ public function findByTableAndIndexReturnsExternalConfiguration(): void 10 => [ 'userFunction' => [ 'class' => Transformation::class, - 'method' => 'stripPositionMarker' - ] - ] - ] - ] + 'method' => 'stripPositionMarker', + ], + ], + ], + ], ], 'columns' => [ 'bundle_code' => [ 'field' => 'code', 'transformations' => [ 10 => [ - 'trim' => true - ] - ] + 'trim' => true, + ], + ], ], 'maker' => [ 'arrayPath' => 'maker/name', 'transformations' => [ 10 => [ - 'trim' => true - ] - ] + 'trim' => true, + ], + ], ], 'name' => [ 'field' => 'name', 'transformations' => [ 10 => [ - 'trim' => true - ] - ] + 'trim' => true, + ], + ], ], 'notes' => [ 'field' => 'notes', 'transformations' => [ 10 => [ - 'trim' => true - ] - ] + 'trim' => true, + ], + ], ], 'products' => [ 'field' => 'product', @@ -376,12 +374,12 @@ public function findByTableAndIndexReturnsExternalConfiguration(): void 10 => [ 'mapping' => [ 'table' => 'tx_externalimporttest_product', - 'referenceField' => 'sku' - ] - ] - ] - ] - ] + 'referenceField' => 'sku', + ], + ], + ], + ], + ], ], $externalConfiguration ); @@ -398,4 +396,4 @@ public function findByTableAndIndexWithWrongInformationThrowsException(): void 'bar' ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Domain/Repository/LogRepositoryTest.php b/Tests/Functional/Domain/Repository/LogRepositoryTest.php index a92753fc..0db242d3 100644 --- a/Tests/Functional/Domain/Repository/LogRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/LogRepositoryTest.php @@ -24,14 +24,12 @@ /** * Test case for the LogRepository class. - * - * @package Cobweb\ExternalImport\Tests\Domain\Repository */ class LogRepositoryTest extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', - 'typo3conf/ext/external_import' + 'typo3conf/ext/external_import', ]; /** @@ -67,62 +65,62 @@ public function queryDataProvider(): array $searchColumns = [ 0 => [ 'searchable' => 'true', - 'name' => 'configuration' + 'name' => 'configuration', ], 1 => [ 'searchable' => 'true', - 'name' => 'message' + 'name' => 'message', ], 2 => [ 'searchable' => 'true', - 'name' => 'context' + 'name' => 'context', ], 3 => [ 'searchable' => 'false', - 'name' => 'crdate' - ] + 'name' => 'crdate', + ], ]; $order = [ 0 => [ 'column' => 3, - 'dir' => 'desc' - ] + 'dir' => 'desc', + ], ]; return [ 'No search, no limit' => [ [ 'search' => [ - 'value' => '' + 'value' => '', ], 'columns' => $searchColumns, - 'order' => $order + 'order' => $order, ], 4, - 4 + 4, ], 'No search, limit 2' => [ [ 'search' => [ - 'value' => '' + 'value' => '', ], 'columns' => $searchColumns, 'length' => 2, - 'order' => $order + 'order' => $order, ], 4, - 2 + 2, ], 'Search for "cli"' => [ [ 'search' => [ - 'value' => 'cli' + 'value' => 'cli', ], 'columns' => $searchColumns, - 'order' => $order + 'order' => $order, ], 3, - 3 - ] + 3, + ], ]; } @@ -173,4 +171,4 @@ public function findBySearchReturnsExpectedRecords(array $parameters, int $fullC $firstRecord->getCrdate()->getTimestamp() ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Domain/Repository/SchedulerRepositoryTest.php b/Tests/Functional/Domain/Repository/SchedulerRepositoryTest.php index ac16b642..cd16ce7a 100644 --- a/Tests/Functional/Domain/Repository/SchedulerRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/SchedulerRepositoryTest.php @@ -21,12 +21,11 @@ /** * Test class for SchedulerRepository - * @package Cobweb\ExternalImport\Tests\Domain\Repository */ class SchedulerRepositoryTest extends FunctionalTestCase { protected $coreExtensionsToLoad = [ - 'scheduler' + 'scheduler', ]; /** @@ -49,13 +48,13 @@ public function fetchAllGroupsReturnsAllExistingGroups(): void $this->importDataSet(__DIR__ . '/../../Fixtures/Scheduler.xml'); $groups = $this->subject->fetchAllGroups(); self::assertSame( - [ - 0 => '', - 5 => 'Group 0', - 1 => 'Group 1', - 3 => 'Group 3' - ], - $groups + [ + 0 => '', + 5 => 'Group 0', + 1 => 'Group 1', + 3 => 'Group 3', + ], + $groups ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Domain/Repository/UidRepositoryTest.php b/Tests/Functional/Domain/Repository/UidRepositoryTest.php index 9c02e903..cea30913 100644 --- a/Tests/Functional/Domain/Repository/UidRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/UidRepositoryTest.php @@ -24,11 +24,9 @@ /** * Test class for the UidRepository - * @package Cobweb\ExternalImport\Tests\Domain\Repository */ class UidRepositoryTest extends FunctionalTestCase { - /** * @var UidRepository */ @@ -50,67 +48,67 @@ public function configurationDataProvider(): array return [ 'No special configuration, no pid restriction' => [ [ - 'referenceUid' => 'tstamp' + 'referenceUid' => 'tstamp', ], [ 1520788063 => 2, - 1520788087 => 3 + 1520788087 => 3, ], [ 1520788063 => 1, - 1520788087 => 2 - ] + 1520788087 => 2, + ], ], 'Pid restriction true' => [ [ 'referenceUid' => 'tstamp', - 'enforcePid' => true + 'enforcePid' => true, ], [ - 1520788063 => 2 + 1520788063 => 2, ], [ - 1520788063 => 1 - ] + 1520788063 => 1, + ], ], 'Pid restriction true-ish' => [ [ 'referenceUid' => 'tstamp', - 'enforcePid' => 1 + 'enforcePid' => 1, ], [ - 1520788063 => 2 + 1520788063 => 2, ], [ - 1520788063 => 1 - ] + 1520788063 => 1, + ], ], 'Pid restriction other than true' => [ [ 'referenceUid' => 'tstamp', - 'enforcePid' => false + 'enforcePid' => false, ], [ 1520788063 => 2, - 1520788087 => 3 + 1520788087 => 3, ], [ 1520788063 => 1, - 1520788087 => 2 - ] + 1520788087 => 2, + ], ], 'Where clause' => [ [ 'referenceUid' => 'tstamp', - 'whereClause' => 'header like \'%deleted%\'' + 'whereClause' => 'header like \'%deleted%\'', ], [ - 1520788087 => 3 + 1520788087 => 3, ], [ - 1520788087 => 2 - ] - ] + 1520788087 => 2, + ], + ], ]; } @@ -149,4 +147,4 @@ public function getExistingUidsWithoutConfigurationThrowsException(): void $this->expectException(\Cobweb\ExternalImport\Exception\MissingConfigurationException::class); $this->subject->getExistingUids(); } -} \ No newline at end of file +} diff --git a/Tests/Functional/ImporterPreviewTest.php b/Tests/Functional/ImporterPreviewTest.php index c1205872..1460ab48 100644 --- a/Tests/Functional/ImporterPreviewTest.php +++ b/Tests/Functional/ImporterPreviewTest.php @@ -28,15 +28,13 @@ use Cobweb\ExternalImport\Step\ValidateDataStep; use Cobweb\ExternalImport\Transformation\ImageTransformation; use Nimut\TestingFramework\TestCase\FunctionalTestCase; +use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\VersionNumberUtility; -use TYPO3\CMS\Core\Localization\LanguageService; /** * Test suite for the preview feature of the Importer class. - * - * @package Cobweb\ExternalImport\Tests\Functional */ class ImporterPreviewTest extends FunctionalTestCase { @@ -46,7 +44,7 @@ class ImporterPreviewTest extends FunctionalTestCase 'typo3conf/ext/svconnector_feed', 'typo3conf/ext/svconnector_json', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -148,7 +146,7 @@ public function readPreviewProvider(): array 'xml-type data' => [ 'table' => 'tx_externalimporttest_product', 'index' => 'base', - 'result' => 'EXT:externalimport_test/Resources/Private/ImportData/Test/Products.xml' + 'result' => 'EXT:externalimport_test/Resources/Private/ImportData/Test/Products.xml', ], 'array-type data' => [ 'table' => 'tx_externalimporttest_tag', @@ -156,30 +154,30 @@ public function readPreviewProvider(): array 'result' => [ [ 'Code' => 'attack', - 'Name' => 'Weapons ' + 'Name' => 'Weapons ', ], [ 'Code' => 'defense', - 'Name' => 'Armor & Shields' + 'Name' => 'Armor & Shields', ], [ 'Code' => 'rude', - 'Name' => 'F**k' + 'Name' => 'F**k', ], [ 'Code' => 'metal', - 'Name' => 'Metallic objects' + 'Name' => 'Metallic objects', ], [ 'Code' => 'fun', - 'Name' => ' Fun, free time' + 'Name' => ' Fun, free time', ], [ 'Code' => 'food', - 'Name' => 'Food & Drinks' - ] - ] - ] + 'Name' => 'Food & Drinks', + ], + ], + ], ]; } @@ -225,7 +223,7 @@ public function handlePreviewProvider(): array 'tags' => 'attack,metal', 'pictures' => 'https://loremflickr.com/320/240/scotland', 'picture_title' => 'View from the left', - 'picture_order' => '2' + 'picture_order' => '2', ], [ 'attributes' => "\n\t\t\tRobust\n\t\t\tStylish\n\t\t\tReliable\n\t\t", @@ -236,7 +234,7 @@ public function handlePreviewProvider(): array 'tags' => 'attack,metal', 'pictures' => 'https://loremflickr.com/320/240/volcano', 'picture_title' => 'View from above', - 'picture_order' => '1' + 'picture_order' => '1', ], [ 'attributes' => "\n\t\t\tRobust\n\t\t\tStylish\n\t\t\tReliable\n\t\t", @@ -246,7 +244,7 @@ public function handlePreviewProvider(): array 'sku' => '000001', 'tags' => 'attack,metal', 'pictures' => 'https://sdnfjwrthioweorg.gdsg/wtf', - 'picture_title' => 'View that does not exist' + 'picture_title' => 'View that does not exist', ], [ 'attributes' => '', @@ -256,9 +254,9 @@ public function handlePreviewProvider(): array 'sku' => '000005', 'tags' => 'defense,metal', 'pictures' => '', - 'picture_title' => '' - ] - ] + 'picture_title' => '', + ], + ], ], 'array-type data' => [ 'table' => 'tx_externalimporttest_tag', @@ -266,29 +264,29 @@ public function handlePreviewProvider(): array 'result' => [ [ 'code' => 'attack', - 'name' => 'Weapons ' + 'name' => 'Weapons ', ], [ 'code' => 'defense', - 'name' => 'Armor & Shields' + 'name' => 'Armor & Shields', ], [ 'code' => 'rude', - 'name' => 'F**k' + 'name' => 'F**k', ], [ 'code' => 'metal', - 'name' => 'Metallic objects' + 'name' => 'Metallic objects', ], [ 'code' => 'fun', - 'name' => ' Fun, free time' + 'name' => ' Fun, free time', ], [ 'code' => 'food', - 'name' => 'Food & Drinks' - ] - ] + 'name' => 'Food & Drinks', + ], + ], ], 'array-type data with sub-structure and array path' => [ 'table' => 'tx_externalimporttest_order', @@ -299,58 +297,58 @@ public function handlePreviewProvider(): array 'order_date' => '2020-08-07 14:32', 'order_id' => '000001', 'products' => '000001', - 'quantity' => 3 + 'quantity' => 3, ], [ 'client_id' => 'Conan the Barbarian', 'order_date' => '2020-08-07 14:32', 'order_id' => '000001', 'products' => '000005', - 'quantity' => 1 + 'quantity' => 1, ], [ 'client_id' => 'Conan the Barbarian', 'order_date' => '2020-08-07 14:32', 'order_id' => '000001', 'products' => '000101', - 'quantity' => 10 + 'quantity' => 10, ], [ 'client_id' => 'Conan the Barbarian', 'order_date' => '2020-08-07 14:32', 'order_id' => '000001', 'products' => '000102', - 'quantity' => 2 + 'quantity' => 2, ], [ 'client_id' => 'Empty basket', 'order_date' => '2021-03-07 17:56', 'order_id' => '000003', - 'products' => null + 'products' => null, ], [ 'client_id' => 'Sonja the Red', 'order_date' => '2020-08-08 06:48', 'order_id' => '000002', 'products' => '000001', - 'quantity' => 1 + 'quantity' => 1, ], [ 'client_id' => 'Sonja the Red', 'order_date' => '2020-08-08 06:48', 'order_id' => '000002', 'products' => '000005', - 'quantity' => 2 + 'quantity' => 2, ], [ 'client_id' => 'Sonja the Red', 'order_date' => '2020-08-08 06:48', 'order_id' => '000002', 'products' => '000202', - 'quantity' => 1 - ] - ] - ] + 'quantity' => 1, + ], + ], + ], ]; } @@ -398,25 +396,25 @@ public function transformPreviewProvider(): array 'result' => [ [ 'code' => 'attack', - 'name' => 'Weapons' + 'name' => 'Weapons', ], [ 'code' => 'defense', - 'name' => 'Armor & Shields' + 'name' => 'Armor & Shields', ], [ 'code' => 'metal', - 'name' => 'Metallic objects' + 'name' => 'Metallic objects', ], [ 'code' => 'fun', - 'name' => 'Fun, free time' + 'name' => 'Fun, free time', ], [ 'code' => 'food', - 'name' => 'Food & Drinks' - ] - ] + 'name' => 'Food & Drinks', + ], + ], ], 'base products' => [ 'table' => 'tx_externalimporttest_product', @@ -430,7 +428,7 @@ public function transformPreviewProvider(): array 'sku' => '000001', 'pictures' => ImageTransformation::$previewMessage, 'picture_title' => 'View from the left', - 'picture_order' => '2' + 'picture_order' => '2', ], [ 'attributes' => "PREVIEW: ", @@ -440,7 +438,7 @@ public function transformPreviewProvider(): array 'sku' => '000001', 'pictures' => ImageTransformation::$previewMessage, 'picture_title' => 'View from above', - 'picture_order' => '1' + 'picture_order' => '1', ], [ 'attributes' => "PREVIEW: ", @@ -449,7 +447,7 @@ public function transformPreviewProvider(): array 'name' => 'Long sword (base)', 'sku' => '000001', 'pictures' => ImageTransformation::$previewMessage, - 'picture_title' => 'View that does not exist' + 'picture_title' => 'View that does not exist', ], [ 'attributes' => null, @@ -458,10 +456,10 @@ public function transformPreviewProvider(): array 'name' => 'Chain mail (base)', 'sku' => '000005', 'pictures' => null, - 'picture_title' => '' - ] - ] - ] + 'picture_title' => '', + ], + ], + ], ]; } @@ -490,7 +488,7 @@ public function storePreviewProvider(): array return [ 'tags' => [ 'fixtures' => [ - __DIR__ . '/Fixtures/StoreDataStepPreviewTest.xml' + __DIR__ . '/Fixtures/StoreDataStepPreviewTest.xml', ], 'prerequisistes' => [], 'table' => 'tx_externalimporttest_tag', @@ -503,45 +501,45 @@ public function storePreviewProvider(): array 'NEW1' => [ 'code' => 'attack', 'name' => 'Weapons', - 'pid' => 1 + 'pid' => 1, ], 'NEW2' => [ 'code' => 'defense', 'name' => 'Armor & Shields', - 'pid' => 1 + 'pid' => 1, ], 'NEW3' => [ 'code' => 'metal', 'name' => 'Metallic objects', - 'pid' => 1 + 'pid' => 1, ], 'NEW4' => [ 'code' => 'fun', 'name' => 'Fun, free time', - 'pid' => 1 + 'pid' => 1, ], 'NEW5' => [ 'code' => 'food', 'name' => 'Food & Drinks', - 'pid' => 1 - ] - ] + 'pid' => 1, + ], + ], ], 'commands-delete' => [ 'tx_externalimporttest_tag' => [ 2 => [ - 'delete' => 1 - ] - ] + 'delete' => 1, + ], + ], ], 'commands-move' => [ - 'tx_externalimporttest_tag' => [] - ] - ] + 'tx_externalimporttest_tag' => [], + ], + ], ], 'tags (only delete)' => [ 'fixtures' => [ - __DIR__ . '/Fixtures/StoreDataStepPreviewTest.xml' + __DIR__ . '/Fixtures/StoreDataStepPreviewTest.xml', ], 'prerequisistes' => [], 'table' => 'tx_externalimporttest_tag', @@ -550,27 +548,27 @@ public function storePreviewProvider(): array 'recordsCount' => 1, 'result' => [ 'data' => [ - 'tx_externalimporttest_tag' => [] + 'tx_externalimporttest_tag' => [], ], 'commands-delete' => [ 'tx_externalimporttest_tag' => [ 2 => [ - 'delete' => 1 - ] - ] + 'delete' => 1, + ], + ], ], 'commands-move' => [ - 'tx_externalimporttest_tag' => [] - ] - ] + 'tx_externalimporttest_tag' => [], + ], + ], ], 'base products (insert)' => [ 'fixtures' => [], 'prerequisistes' => [ [ 'table' => 'tx_externalimporttest_tag', - 'index' => 0 - ] + 'index' => 0, + ], ], 'table' => 'tx_externalimporttest_product', 'index' => 'base', @@ -587,7 +585,7 @@ public function storePreviewProvider(): array 'pictures' => 'NEW2,NEW3,NEW4', 'sku' => '000001', 'tags' => '1,3', - 'pid' => 1 + 'pid' => 1, ], 'NEW5' => [ 'attributes' => null, @@ -597,8 +595,8 @@ public function storePreviewProvider(): array 'sku' => '000005', 'tags' => '2,3', 'pictures' => '', - 'pid' => 1 - ] + 'pid' => 1, + ], ], 'sys_file_reference' => [ 'NEW2' => [ @@ -607,7 +605,7 @@ public function storePreviewProvider(): array 'title' => 'View from the left', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 + 'pid' => 1, ], 'NEW3' => [ 'uid_local' => ImageTransformation::$previewMessage, @@ -615,7 +613,7 @@ public function storePreviewProvider(): array 'title' => 'View from above', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 + 'pid' => 1, ], 'NEW4' => [ 'uid_local' => ImageTransformation::$previewMessage, @@ -623,23 +621,23 @@ public function storePreviewProvider(): array 'title' => 'View that does not exist', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 - ] - ] + 'pid' => 1, + ], + ], ], 'commands-delete' => [], 'commands-move' => [ - 'tx_externalimporttest_product' => [] - ] - ] + 'tx_externalimporttest_product' => [], + ], + ], ], 'base products (update)' => [ 'fixtures' => [], 'prerequisistes' => [ [ 'table' => 'tx_externalimporttest_product', - 'index' => 'base' - ] + 'index' => 'base', + ], ], 'table' => 'tx_externalimporttest_product', 'index' => 'base', @@ -654,15 +652,15 @@ public function storePreviewProvider(): array 'created' => 1634286540, 'name' => 'Long sword (base)', 'pictures' => 'NEW1,NEW2,NEW3', - 'sku' => '000001' + 'sku' => '000001', ], '2' => [ 'attributes' => null, 'categories' => '', 'created' => 1629981780, 'name' => 'Chain mail (base)', - 'sku' => '000005' - ] + 'sku' => '000005', + ], ], // Normally this should not contain new records, as images have been imported during the prerequisite // import. However, since we are in preview mode, the ImageTransformation class does not @@ -675,7 +673,7 @@ public function storePreviewProvider(): array 'title' => 'View from the left', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 + 'pid' => 1, ], 'NEW2' => [ 'uid_local' => 'Preview mode. Image not handled, nor saved.', @@ -683,7 +681,7 @@ public function storePreviewProvider(): array 'title' => 'View from above', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 + 'pid' => 1, ], 'NEW3' => [ 'uid_local' => ImageTransformation::$previewMessage, @@ -691,27 +689,27 @@ public function storePreviewProvider(): array 'title' => 'View that does not exist', 'tablenames' => 'tx_externalimporttest_product', 'fieldname' => 'pictures', - 'pid' => 1 - ] - ] + 'pid' => 1, + ], + ], ], 'commands-delete' => [ - 'sys_file_reference' => [] + 'sys_file_reference' => [], ], 'commands-move' => [ - 'tx_externalimporttest_product' => [] - ] - ] + 'tx_externalimporttest_product' => [], + ], + ], ], 'update products with move' => [ 'fixtures' => [ - __DIR__ . '/Fixtures/ExtraStoragePage.xml' + __DIR__ . '/Fixtures/ExtraStoragePage.xml', ], 'prerequisistes' => [ [ 'table' => 'tx_externalimporttest_product', - 'index' => 'base' - ] + 'index' => 'base', + ], ], 'table' => 'tx_externalimporttest_product', 'index' => 'updated_products', @@ -723,35 +721,35 @@ public function storePreviewProvider(): array '1' => [ 'name' => 'Long sword (updated)', 'pid' => '2', - 'sku' => '000001' - ] - ] + 'sku' => '000001', + ], + ], ], 'commands-delete' => [], 'commands-move' => [ 'tx_externalimporttest_product' => [ '1' => [ - 'move' => 2 - ] - ] - ] - ] + 'move' => 2, + ], + ], + ], + ], ], 'bundles' => [ 'fixtures' => [], 'prerequisites' => [ [ 'table' => 'tx_externalimporttest_product', - 'index' => 'base' + 'index' => 'base', ], [ 'table' => 'tx_externalimporttest_product', - 'index' => 'more' + 'index' => 'more', ], [ 'table' => 'tx_externalimporttest_product', - 'index' => 'stable' - ] + 'index' => 'stable', + ], ], 'table' => 'tx_externalimporttest_bundle', 'index' => 0, @@ -766,7 +764,7 @@ public function storePreviewProvider(): array 'name' => 'Bundle of joy', 'notes' => 'This will make you very happy', 'products' => '3,4', - 'pid' => 1 + 'pid' => 1, ], 'NEW2' => [ 'bundle_code' => 'PAIN01', @@ -774,7 +772,7 @@ public function storePreviewProvider(): array 'name' => 'Bundle of pain', 'notes' => 'Maybe you don\'t want this bundle at all', 'products' => '1,2', - 'pid' => 1 + 'pid' => 1, ], 'NEW3' => [ 'bundle_code' => 'PAIN02', @@ -782,33 +780,33 @@ public function storePreviewProvider(): array 'name' => 'Bundle of extra pain', 'notes' => null, 'products' => '6,1,5,2', - 'pid' => 1 - ] - ] + 'pid' => 1, + ], + ], ], 'commands-delete' => [], 'commands-move' => [ - 'tx_externalimporttest_bundle' => [] - ] - ] + 'tx_externalimporttest_bundle' => [], + ], + ], ], 'orders' => [ 'fixtures' => [ - __DIR__ . '/Fixtures/Orders.xml' + __DIR__ . '/Fixtures/Orders.xml', ], 'prerequisites' => [ [ 'table' => 'tx_externalimporttest_product', - 'index' => 'base' + 'index' => 'base', ], [ 'table' => 'tx_externalimporttest_product', - 'index' => 'more' + 'index' => 'more', ], [ 'table' => 'tx_externalimporttest_product', - 'index' => 'stable' - ] + 'index' => 'stable', + ], ], 'table' => 'tx_externalimporttest_order', 'index' => 0, @@ -821,85 +819,85 @@ public function storePreviewProvider(): array 'client_id' => 'Conan the Barbarian', 'order_date' => 1596810720, 'order_id' => '000001', - 'products' => '1,NEW2,NEW3,NEW4' + 'products' => '1,NEW2,NEW3,NEW4', ], 'NEW5' => [ 'client_id' => 'Empty basket', 'order_date' => 1615139760, 'order_id' => '000003', 'products' => '', - 'pid' => 1 + 'pid' => 1, ], 'NEW6' => [ 'client_id' => 'Sonja the Red', 'order_date' => 1596869280, 'order_id' => '000002', 'products' => 'NEW7,NEW8,NEW9', - 'pid' => 1 - ] + 'pid' => 1, + ], ], 'tx_externalimporttest_order_items' => [ 1 => [ 'uid_local' => 1, 'uid_foreign' => '1', 'quantity' => 3, - 'pid' => 1 + 'pid' => 1, ], 'NEW2' => [ 'uid_local' => 1, 'uid_foreign' => '2', 'quantity' => 1, - 'pid' => 1 + 'pid' => 1, ], 'NEW3' => [ 'uid_local' => 1, 'uid_foreign' => '3', 'quantity' => 10, - 'pid' => 1 + 'pid' => 1, ], 'NEW4' => [ 'uid_local' => 1, 'uid_foreign' => '4', 'quantity' => 2, - 'pid' => 1 + 'pid' => 1, ], 'NEW7' => [ 'uid_local' => 'NEW6', 'uid_foreign' => '1', 'quantity' => 1, - 'pid' => 1 + 'pid' => 1, ], 'NEW8' => [ 'uid_local' => 'NEW6', 'uid_foreign' => '2', 'quantity' => 2, - 'pid' => 1 + 'pid' => 1, ], 'NEW9' => [ 'uid_local' => 'NEW6', 'uid_foreign' => '6', 'quantity' => 1, - 'pid' => 1 + 'pid' => 1, ], - ] + ], ], 'commands-delete' => [ 'tx_externalimporttest_order_items' => [ 2 => [ - 'delete' => 1 - ] + 'delete' => 1, + ], ], 'tx_externalimporttest_order' => [ 12 => [ - 'delete' => 1 - ] - ] + 'delete' => 1, + ], + ], ], 'commands-move' => [ - 'tx_externalimporttest_order' => [] - ] - ] - ] + 'tx_externalimporttest_order' => [], + ], + ], + ], ]; } @@ -972,18 +970,18 @@ public function clearCachePreviewProvider(): array 'table' => 'tx_externalimporttest_tag', 'index' => 0, 'result' => [ - 'caches' => [] - ] + 'caches' => [], + ], ], 'product pages' => [ 'table' => 'pages', 'index' => 'product_pages', 'result' => [ 'caches' => [ - 'pages' - ] - ] - ] + 'pages', + ], + ], + ], ]; } @@ -1040,4 +1038,4 @@ public function runPreviewOnConnectorCallbackStepReturnsNull(): void $this->subject->getPreviewData() ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/ImporterTest.php b/Tests/Functional/ImporterTest.php index 049ab5e4..72880a99 100644 --- a/Tests/Functional/ImporterTest.php +++ b/Tests/Functional/ImporterTest.php @@ -20,15 +20,13 @@ use Cobweb\ExternalImport\Importer; use Cobweb\ExternalImport\Step\StoreDataStep; use Nimut\TestingFramework\TestCase\FunctionalTestCase; +use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Localization\LanguageService; /** * Testcase for the External Import importer - * - * @package Cobweb\ExternalImport\Tests\Functional */ class ImporterTest extends FunctionalTestCase { @@ -38,7 +36,7 @@ class ImporterTest extends FunctionalTestCase 'typo3conf/ext/svconnector_feed', 'typo3conf/ext/svconnector_json', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -223,7 +221,7 @@ public function importBaseProductsWithImporterStoresTwoRecordsAndCreatesRelation self::assertSame( [ 1 => '1,3', - 2 => '2,3' + 2 => '2,3', ], $tagRelations ); @@ -231,7 +229,7 @@ public function importBaseProductsWithImporterStoresTwoRecordsAndCreatesRelation self::assertSame( [ 2 => 1, - 1 => 2 + 1 => 2, ], $sorting ); @@ -441,7 +439,6 @@ public function importBundlesWithImporterStoresThreeRecordsAndCreatesOrderedRela * The notes field of that bundle are expected to be nulled. * * @test - * @return void */ public function importBundlesWithImporterOnExistingBundleSetNull(): void { @@ -640,16 +637,16 @@ public function importProductsAsPagesWithImporterCreatesProperPageTree(): void $pageTree = [ [ 'title' => 'Product 1', - 'children' => 2 + 'children' => 2, ], [ 'title' => 'Product 2', - 'children' => 0 + 'children' => 0, ], [ 'title' => 'Product 3', - 'children' => 1 - ] + 'children' => 1, + ], ]; foreach ($pageTree as $page) { $children = $this->getDatabaseConnection()->selectCount( @@ -726,12 +723,12 @@ public function wrongConfigurationNames(): array return [ 'Wrong general configuration' => [ 'tx_externalimporttest_product', - 'general_configuration_errors' + 'general_configuration_errors', ], 'Wrong column configuration' => [ 'sys_categories', - 'column_configuration_errors' - ] + 'column_configuration_errors', + ], ]; } @@ -758,4 +755,4 @@ public function importWithErroneousConfigurationReturnsError(string $table, stri self::assertEquals(AbstractMessage::ERROR, $messageLevel, serialize($messages)); self::assertCount(1, $messagesForLevel); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Step/StoreDataStepTest.php b/Tests/Functional/Step/StoreDataStepTest.php index 4ceee738..8afa94f9 100644 --- a/Tests/Functional/Step/StoreDataStepTest.php +++ b/Tests/Functional/Step/StoreDataStepTest.php @@ -36,7 +36,7 @@ class StoreDataStepTest extends FunctionalTestCase protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -61,136 +61,136 @@ public function dataToStoreProvider(): array return [ 'no denormalized data' => [ 'generalConfiguration' => [ - 'referenceUid' => 'code' + 'referenceUid' => 'code', ], 'columnConfiguration' => [ 'code' => [], 'first_name' => [], 'last_name' => [], 'useless' => [ - Configuration::DO_NOT_SAVE_KEY => true - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], ], 'input' => [ [ 'code' => 'JP', 'first_name' => 'Joey', 'last_name' => 'Pechorin', - 'useless' => 'Useless information' + 'useless' => 'Useless information', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', - 'useless' => 'Useless information' - ] + 'useless' => 'Useless information', + ], ], 'output' => [ 1 => [ 'code' => 'JP', 'first_name' => 'Joey', - 'last_name' => 'Pechorin' + 'last_name' => 'Pechorin', ], 'NEW1' => [ 'code' => 'AP', 'first_name' => 'Amnesia', - 'last_name' => 'Phreedom' - ] + 'last_name' => 'Phreedom', + ], ], 'existingUids' => [ - 'JP' => 1 - ] + 'JP' => 1, + ], ], 'no denormalized data - insert disabled' => [ 'generalConfiguration' => [ 'referenceUid' => 'code', - 'disabledOperations' => 'insert' + 'disabledOperations' => 'insert', ], 'columnConfiguration' => [ 'code' => [], 'first_name' => [], 'last_name' => [], 'useless' => [ - Configuration::DO_NOT_SAVE_KEY => true - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], ], 'input' => [ [ 'code' => 'JP', 'first_name' => 'Joey', 'last_name' => 'Pechorin', - 'useless' => 'Useless information' + 'useless' => 'Useless information', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', - 'useless' => 'Useless information' - ] + 'useless' => 'Useless information', + ], ], 'output' => [ 1 => [ 'code' => 'JP', 'first_name' => 'Joey', - 'last_name' => 'Pechorin' - ] + 'last_name' => 'Pechorin', + ], ], 'existingUids' => [ - 'JP' => 1 - ] + 'JP' => 1, + ], ], 'no denormalized data - update disabled' => [ 'generalConfiguration' => [ 'referenceUid' => 'code', - 'disabledOperations' => 'update' + 'disabledOperations' => 'update', ], 'columnConfiguration' => [ 'code' => [], 'first_name' => [], 'last_name' => [], 'useless' => [ - Configuration::DO_NOT_SAVE_KEY => true - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], ], 'input' => [ [ 'code' => 'JP', 'first_name' => 'Joey', 'last_name' => 'Pechorin', - 'useless' => 'Useless information' + 'useless' => 'Useless information', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', - 'useless' => 'Useless information' - ] + 'useless' => 'Useless information', + ], ], 'output' => [ 'NEW1' => [ 'code' => 'AP', 'first_name' => 'Amnesia', - 'last_name' => 'Phreedom' - ] + 'last_name' => 'Phreedom', + ], ], 'existingUids' => [ - 'JP' => 1 - ] + 'JP' => 1, + ], ], 'single denormalized data' => [ 'generalConfiguration' => [ - 'referenceUid' => 'code' + 'referenceUid' => 'code', ], 'columnConfiguration' => [ 'code' => [], 'first_name' => [], 'last_name' => [], 'book' => [ - 'multipleRows' => true + 'multipleRows' => true, ], 'useless' => [ - Configuration::DO_NOT_SAVE_KEY => true - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], ], 'input' => [ [ @@ -198,55 +198,55 @@ public function dataToStoreProvider(): array 'first_name' => 'Joey', 'last_name' => 'Pechorin', 'book' => 2, - 'useless' => 'Useless information' + 'useless' => 'Useless information', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 1, - 'useless' => 'Useless information' + 'useless' => 'Useless information', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 2, - 'useless' => 'Useless information' - ] + 'useless' => 'Useless information', + ], ], 'output' => [ 1 => [ 'code' => 'JP', 'first_name' => 'Joey', 'last_name' => 'Pechorin', - 'book' => '2' + 'book' => '2', ], 'NEW1' => [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', - 'book' => '1,2' - ] + 'book' => '1,2', + ], ], 'existingUids' => [ - 'JP' => 1 - ] + 'JP' => 1, + ], ], 'multiple denormalized data' => [ 'generalConfiguration' => [ - 'referenceUid' => 'code' + 'referenceUid' => 'code', ], 'columnConfiguration' => [ 'code' => [], 'first_name' => [], 'last_name' => [], 'book' => [ - 'multipleRows' => true + 'multipleRows' => true, ], 'relations' => [ - 'multipleRows' => true - ] + 'multipleRows' => true, + ], ], 'input' => [ [ @@ -254,43 +254,43 @@ public function dataToStoreProvider(): array 'first_name' => 'Joey', 'last_name' => 'Pechorin', 'book' => 2, - 'relations' => 'TP' + 'relations' => 'TP', ], [ 'code' => 'JP', 'first_name' => 'Joey', 'last_name' => 'Pechorin', 'book' => 2, - 'relations' => 'JF' + 'relations' => 'JF', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 1, - 'relations' => 'JP' + 'relations' => 'JP', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 1, - 'relations' => 'JF' + 'relations' => 'JF', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 2, - 'relations' => 'JP' + 'relations' => 'JP', ], [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => 2, - 'relations' => 'JF' - ] + 'relations' => 'JF', + ], ], 'output' => [ 1 => [ @@ -298,23 +298,23 @@ public function dataToStoreProvider(): array 'first_name' => 'Joey', 'last_name' => 'Pechorin', 'book' => '2', - 'relations' => 'TP,JF' + 'relations' => 'TP,JF', ], 'NEW1' => [ 'code' => 'AP', 'first_name' => 'Amnesia', 'last_name' => 'Phreedom', 'book' => '1,2', - 'relations' => 'JP,JF' - ] + 'relations' => 'JP,JF', + ], ], 'existingUids' => [ - 'JP' => 1 - ] + 'JP' => 1, + ], ], 'children data' => [ 'generalConfiguration' => [ - 'referenceUid' => 'order' + 'referenceUid' => 'order', ], 'columnConfiguration' => [ 'order' => [], @@ -330,50 +330,50 @@ public function dataToStoreProvider(): array 'field' => 'products', ], 'quantity' => [ - 'field' => 'quantity' - ] - ] - ] - ] + 'field' => 'quantity', + ], + ], + ], + ], ], 'input' => [ [ 'order' => '000001', 'customer' => 'Conan the Barbarian', 'products' => 1, - 'quantity' => 3 + 'quantity' => 3, ], [ 'order' => '000001', 'customer' => 'Conan the Barbarian', 'products' => 2, - 'quantity' => 5 + 'quantity' => 5, ], [ 'order' => '000001', 'customer' => 'Conan the Barbarian', 'products' => 3, - 'quantity' => 10 + 'quantity' => 10, ], [ 'order' => '000002', 'customer' => 'Sonja the Red', 'products' => 1, - 'quantity' => 2 + 'quantity' => 2, ], [ 'order' => '000002', 'customer' => 'Sonja the Red', 'products' => 2, - 'quantity' => 3 + 'quantity' => 3, ], [ 'order' => '000003', 'customer' => 'The Black Currant', // Test that no children are generated, because the field is not defined 'products' => null, - 'quantity' => 3 - ] + 'quantity' => 3, + ], ], 'output' => [ 1 => [ @@ -386,21 +386,21 @@ public function dataToStoreProvider(): array 'NEW1' => [ 'uid_local' => 1, 'uid_foreign' => 1, - 'quantity' => 3 + 'quantity' => 3, ], 'NEW2' => [ 'uid_local' => 1, 'uid_foreign' => 2, - 'quantity' => 5 + 'quantity' => 5, ], 'NEW3' => [ 'uid_local' => 1, 'uid_foreign' => 3, - 'quantity' => 10 - ] - ] - ] - ] + 'quantity' => 10, + ], + ], + ], + ], ], 'NEW4' => [ 'order' => '000002', @@ -412,26 +412,26 @@ public function dataToStoreProvider(): array 'NEW5' => [ 'uid_local' => 'NEW4', 'uid_foreign' => 1, - 'quantity' => 2 + 'quantity' => 2, ], 'NEW6' => [ 'uid_local' => 'NEW4', 'uid_foreign' => 2, - 'quantity' => 3 - ] - ] - ] - ] + 'quantity' => 3, + ], + ], + ], + ], ], 'NEW7' => [ 'order' => '000003', 'customer' => 'The Black Currant', - '__children__' => [] - ] + '__children__' => [], + ], ], 'existingUids' => [ - '000001' => 1 - ] + '000001' => 1, + ], ], ]; } @@ -482,22 +482,22 @@ public function childStructureProvider(): array 'field' => 'products', ], 'quantity' => [ - 'field' => 'quantity' - ] + 'field' => 'quantity', + ], ], 'parentId' => 'NEW2', 'parentData' => [ 'products' => 1, - 'quantity' => 3 + 'quantity' => 3, ], 'result' => [ 'NEW1' => [ 'uid_local' => 'NEW2', 'uid_foreign' => 1, - 'quantity' => 3 - ] - ] - ] + 'quantity' => 3, + ], + ], + ], ]; } diff --git a/Tests/Functional/Step/TransformDataStepTest.php b/Tests/Functional/Step/TransformDataStepTest.php index 243875aa..3e2eab50 100644 --- a/Tests/Functional/Step/TransformDataStepTest.php +++ b/Tests/Functional/Step/TransformDataStepTest.php @@ -27,15 +27,13 @@ /** * Test suite for the TransformDataStep class. - * - * @package Cobweb\ExternalImport\Tests\Unit\Validator */ class TransformDataStepTest extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -67,39 +65,39 @@ public function trimDataProvider(): array [ 0 => [ 'foo' => ' White space all around ', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 1 => [ 'foo' => ' White space left', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 2 => [ 'foo' => 'White space right ', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 3 => [ 'foo' => 'No white space', - 'bar' => ' Not trimmed ' - ] + 'bar' => ' Not trimmed ', + ], ], [ 0 => [ 'foo' => 'White space all around', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 1 => [ 'foo' => 'White space left', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 2 => [ 'foo' => 'White space right', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 3 => [ 'foo' => 'No white space', - 'bar' => ' Not trimmed ' - ] - ] + 'bar' => ' Not trimmed ', + ], + ], ], 'Do not trim data (false)' => [ 'foo', @@ -107,56 +105,56 @@ public function trimDataProvider(): array [ 0 => [ 'foo' => ' White space all around ', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 1 => [ 'foo' => 'No white space', - 'bar' => ' Not trimmed ' - ] + 'bar' => ' Not trimmed ', + ], ], [ 0 => [ 'foo' => ' White space all around ', - 'bar' => ' Not trimmed ' + 'bar' => ' Not trimmed ', ], 1 => [ 'foo' => 'No white space', - 'bar' => ' Not trimmed ' - ] - ] + 'bar' => ' Not trimmed ', + ], + ], ], 'Trim not string data' => [ 'foo', true, [ 0 => [ - 'foo' => ['bar' => 'baz'] + 'foo' => ['bar' => 'baz'], ], 1 => [ - 'foo' => 2 + 'foo' => 2, ], 2 => [ - 'foo' => true + 'foo' => true, ], 3 => [ - 'bar' => 'baz' - ] + 'bar' => 'baz', + ], ], [ 0 => [ - 'foo' => ['bar' => 'baz'] + 'foo' => ['bar' => 'baz'], ], 1 => [ - 'foo' => 2 + 'foo' => 2, ], 2 => [ - 'foo' => true + 'foo' => true, ], 3 => [ - 'bar' => 'baz' - ] - ] - ] + 'bar' => 'baz', + ], + ], + ], ]; } @@ -188,71 +186,71 @@ public function mappingDataProvider(): array [ 'table' => 'sys_category', 'referenceField' => 'external_key', - 'default' => 19 + 'default' => 19, ], [ 0 => [ 'foo' => 'USEFUL', - 'bar' => 42 + 'bar' => 42, ], 1 => [ 'foo' => 'USELESS', - 'bar' => 17 + 'bar' => 17, ], 2 => [ 'foo' => 'UNKNOWN', - 'bar' => 24 + 'bar' => 24, ], ], [ 0 => [ 'foo' => '1', - 'bar' => 42 + 'bar' => 42, ], 1 => [ 'foo' => '2', - 'bar' => 17 + 'bar' => 17, ], 2 => [ 'foo' => 19, - 'bar' => 24 - ] - ] + 'bar' => 24, + ], + ], ], 'Map to sys_category without default value' => [ 'foo', [ 'table' => 'sys_category', - 'referenceField' => 'external_key' + 'referenceField' => 'external_key', ], [ 0 => [ 'foo' => 'USEFUL', - 'bar' => 42 + 'bar' => 42, ], 1 => [ 'foo' => 'USELESS', - 'bar' => 17 + 'bar' => 17, ], 2 => [ 'foo' => 'UNKNOWN', - 'bar' => 24 + 'bar' => 24, ], ], [ 0 => [ 'foo' => '1', - 'bar' => 42 + 'bar' => 42, ], 1 => [ 'foo' => '2', - 'bar' => 17 + 'bar' => 17, ], 2 => [ - 'bar' => 24 - ] - ] - ] + 'bar' => 24, + ], + ], + ], ]; } @@ -291,24 +289,24 @@ public function applyValueAppliesValue(): void [ 0 => [ 'foo' => 17, - 'bar' => 4 + 'bar' => 4, ], 1 => [ 'foo' => 23, - 'bar' => 8 - ] + 'bar' => 8, + ], ] ); self::assertSame( [ 0 => [ 'foo' => 42, - 'bar' => 4 + 'bar' => 4, ], 1 => [ 'foo' => 42, - 'bar' => 8 - ] + 'bar' => 8, + ], ], $result ); @@ -327,12 +325,12 @@ public function applyRteEnabledFlagAppliesFlag(): void [ 0 => [ 'foo' => 17, - 'bar' => 4 + 'bar' => 4, ], 1 => [ 'foo' => 23, - 'bar' => 8 - ] + 'bar' => 8, + ], ] ); self::assertSame( @@ -340,13 +338,13 @@ public function applyRteEnabledFlagAppliesFlag(): void 0 => [ 'foo' => 17, 'bar' => 4, - '_TRANSFORM_foo' => 'RTE' + '_TRANSFORM_foo' => 'RTE', ], 1 => [ 'foo' => 23, 'bar' => 8, - '_TRANSFORM_foo' => 'RTE' - ] + '_TRANSFORM_foo' => 'RTE', + ], ], $result ); @@ -362,22 +360,22 @@ public function userFunctionDataProvider(): array 'method' => 'parseDate', 'parameters' => [ 'function' => 'date', - 'format' => 'U' - ] + 'format' => 'U', + ], ], [ 0 => [ 'foo' => '2017-10-11T18:29:01+02:00', - 'bar' => 4 - ] + 'bar' => 4, + ], ], [ 0 => [ 'foo' => '1507739341', - 'bar' => 4 - ] - ] - ] + 'bar' => 4, + ], + ], + ], ]; } @@ -406,186 +404,186 @@ public function isEmptyDataProvider(): array $emptyArray = [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 2 => [ 'foo' => '', - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 3 => [ 'foo' => 0, - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 4 => [ 'foo' => false, - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 5 => [ 'foo' => null, - 'bar' => 'Foo is empty' - ] + 'bar' => 'Foo is empty', + ], ]; return [ 'No empty records - no expression - nothing happens' => [ 'name' => 'foo', 'configuration' => [ - 'invalidate' => true + 'invalidate' => true, ], 'records' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'foo' => 'This is me!', - 'bar' => 'Foo is not empty' - ] + 'bar' => 'Foo is not empty', + ], ], 'expected' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'foo' => 'This is me!', - 'bar' => 'Foo is not empty' - ] - ] + 'bar' => 'Foo is not empty', + ], + ], ], 'Empty records - no expression - invalidate' => [ 'name' => 'foo', 'configuration' => [ - 'invalidate' => true + 'invalidate' => true, ], 'records' => $emptyArray, 'expected' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' - ] - ] + 'bar' => 'Foo is not empty', + ], + ], ], 'Empty records - no expression - default value' => [ 'name' => 'foo', 'configuration' => [ - 'default' => 'Foo is foo' + 'default' => 'Foo is foo', ], 'records' => $emptyArray, 'expected' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'bar' => 'Foo is empty', - 'foo' => 'Foo is foo' + 'foo' => 'Foo is foo', ], 2 => [ 'foo' => 'Foo is foo', - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 3 => [ 'foo' => 'Foo is foo', - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 4 => [ 'foo' => 'Foo is foo', - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 5 => [ 'foo' => 'Foo is foo', - 'bar' => 'Foo is empty' - ] - ] + 'bar' => 'Foo is empty', + ], + ], ], 'Empty records - expression (null) - invalidate' => [ 'name' => 'foo', 'configuration' => [ 'expression' => 'foo === null', - 'invalidate' => true + 'invalidate' => true, ], 'records' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 2 => [ 'foo' => 'Me again :-)', - 'bar' => 'Foo is not empty' - ] + 'bar' => 'Foo is not empty', + ], ], 'expected' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'foo' => 'Me again :-)', - 'bar' => 'Foo is not empty' - ] - ] + 'bar' => 'Foo is not empty', + ], + ], ], 'Empty records - expression (empty string) - invalidate' => [ 'name' => 'foo', 'configuration' => [ 'expression' => 'foo === ""', - 'invalidate' => true + 'invalidate' => true, ], 'records' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'foo' => '', - 'bar' => 'Foo is empty' + 'bar' => 'Foo is empty', ], 2 => [ 'foo' => 'Me again :-)', - 'bar' => 'Foo is not empty' - ] + 'bar' => 'Foo is not empty', + ], ], 'expected' => [ 0 => [ 'foo' => 'Hello world', - 'bar' => 'Foo is not empty' + 'bar' => 'Foo is not empty', ], 1 => [ 'foo' => 'Me again :-)', - 'bar' => 'Foo is not empty' - ] - ] + 'bar' => 'Foo is not empty', + ], + ], ], 'Expression not testing emptiness' => [ 'name' => 'foo', 'configuration' => [ 'expression' => 'foo + bar', - 'invalidate' => true + 'invalidate' => true, ], 'records' => [ // This first record will be removed, because 2 + 5 = 7, which is equivalent to true when casting to boolean 0 => [ 'foo' => 2, - 'bar' => 5 + 'bar' => 5, ], 1 => [ 'foo' => 1, - 'bar' => -1 - ] + 'bar' => -1, + ], ], 'expected' => [ 0 => [ 'foo' => 1, - 'bar' => -1 - ] - ] - ] + 'bar' => -1, + ], + ], + ], ]; } diff --git a/Tests/Functional/Utility/MappingUtilityTest.php b/Tests/Functional/Utility/MappingUtilityTest.php index 2997737a..f25754cd 100644 --- a/Tests/Functional/Utility/MappingUtilityTest.php +++ b/Tests/Functional/Utility/MappingUtilityTest.php @@ -25,15 +25,13 @@ * Test class for the MappingUtility. * * NOTE: the MappingUtility is also covered by unit tests. - * - * @package Cobweb\ExternalImport\Tests\Functional\Utility */ class MappingUtilityTest extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -54,60 +52,60 @@ public function mappingConfigurationProvider(): array [ 'valueMap' => [ 'foo' => 1, - 'bar' => 2 + 'bar' => 2, ], 'table' => 'sys_category', - 'referenceField' => 'external_key' + 'referenceField' => 'external_key', ], [ 'foo' => 1, - 'bar' => 2 - ] + 'bar' => 2, + ], ], 'All records (no valueField property)' => [ [ 'table' => 'sys_category', - 'referenceField' => 'external_key' + 'referenceField' => 'external_key', ], [ 'CAT1' => 1, 'CAT2' => 2, - '0' => 4 - ] + '0' => 4, + ], ], 'All records (with valueField property)' => [ [ 'table' => 'sys_category', 'referenceField' => 'external_key', - 'valueField' => 'uid' + 'valueField' => 'uid', ], [ 'CAT1' => 1, 'CAT2' => 2, - '0' => 4 - ] + '0' => 4, + ], ], 'All records (with non-uid valueField property)' => [ [ 'table' => 'sys_category', 'referenceField' => 'external_key', - 'valueField' => 'title' + 'valueField' => 'title', ], [ 'CAT1' => 'Category 1', 'CAT2' => 'Category 2', - '0' => 'Category 4' - ] + '0' => 'Category 4', + ], ], 'Filtered records' => [ [ 'table' => 'sys_category', 'referenceField' => 'external_key', - 'whereClause' => 'pid = 1' + 'whereClause' => 'pid = 1', ], [ - 'CAT1' => 1 - ] + 'CAT1' => 1, + ], ], ]; } @@ -136,100 +134,100 @@ public function dataToMapProvider(): array 'records' => [ 0 => [ 'title' => 'Page with matching category', - 'categories' => 'CAT2' + 'categories' => 'CAT2', ], 1 => [ 'title' => 'Page with non-matching category', - 'categories' => 'CATX' + 'categories' => 'CATX', ], 2 => [ - 'title' => 'Page with missing category' - ] + 'title' => 'Page with missing category', + ], ], 'table' => 'pages', 'field' => 'categories', 'mappingConfiguration' => [ 'default' => 1, 'table' => 'sys_category', - 'referenceField' => 'external_key' + 'referenceField' => 'external_key', ], 'result' => [ 0 => [ 'title' => 'Page with matching category', - 'categories' => '2' + 'categories' => '2', ], 1 => [ 'title' => 'Page with non-matching category', - 'categories' => 1 + 'categories' => 1, ], 2 => [ 'title' => 'Page with missing category', - 'categories' => 1 - ] - ] + 'categories' => 1, + ], + ], ], 'Field gets unset without default value' => [ 'records' => [ 0 => [ 'title' => 'Page with matching category', - 'categories' => 'CAT2' + 'categories' => 'CAT2', ], 1 => [ 'title' => 'Page with non-matching category', - 'categories' => 'CATX' + 'categories' => 'CATX', ], 2 => [ - 'title' => 'Page with missing category' - ] + 'title' => 'Page with missing category', + ], ], 'table' => 'pages', 'field' => 'categories', 'mappingConfiguration' => [ 'table' => 'sys_category', - 'referenceField' => 'external_key' + 'referenceField' => 'external_key', ], 'result' => [ 0 => [ 'title' => 'Page with matching category', - 'categories' => '2' + 'categories' => '2', ], 1 => [ - 'title' => 'Page with non-matching category' + 'title' => 'Page with non-matching category', ], 2 => [ - 'title' => 'Page with missing category' - ] - ] + 'title' => 'Page with missing category', + ], + ], ], 'Multiple values separator' => [ 'records' => [ 0 => [ 'title' => 'Page with two matching categories', - 'categories' => 'CAT1,CAT2' + 'categories' => 'CAT1,CAT2', ], 1 => [ 'title' => 'Page with one matching and one non-matching category', - 'categories' => 'CAT1,CATX' - ] + 'categories' => 'CAT1,CATX', + ], ], 'table' => 'pages', 'field' => 'categories', 'mappingConfiguration' => [ 'table' => 'sys_category', 'referenceField' => 'external_key', - 'multipleValuesSeparator' => ',' + 'multipleValuesSeparator' => ',', ], 'result' => [ 0 => [ 'title' => 'Page with two matching categories', - 'categories' => '1,2' + 'categories' => '1,2', ], 1 => [ 'title' => 'Page with one matching and one non-matching category', - 'categories' => '1' - ] - ] - ] + 'categories' => '1', + ], + ], + ], ]; } @@ -257,4 +255,4 @@ public function mapDataMapsDataAndAppliesDefaultValueIfDefined( $mappedRecords ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Utility/SlugUtilityTest.php b/Tests/Functional/Utility/SlugUtilityTest.php index 298fb900..9169f50c 100644 --- a/Tests/Functional/Utility/SlugUtilityTest.php +++ b/Tests/Functional/Utility/SlugUtilityTest.php @@ -24,15 +24,13 @@ /** * Test class for the SlugUtility. - * - * @package Cobweb\ExternalImport\Tests\Functional\Utility */ class SlugUtilityTest extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', 'typo3conf/ext/external_import', - 'typo3conf/ext/externalimport_test' + 'typo3conf/ext/externalimport_test', ]; /** @@ -59,4 +57,4 @@ public function resolveSlugFieldNamesFindsListOfSlugFields(): void $this->subject->resolveSlugFieldNames('tx_externalimporttest_product') ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Validator/ColumnConfigurationValidatorTest.php b/Tests/Functional/Validator/ColumnConfigurationValidatorTest.php index f36a7ef6..648fe545 100644 --- a/Tests/Functional/Validator/ColumnConfigurationValidatorTest.php +++ b/Tests/Functional/Validator/ColumnConfigurationValidatorTest.php @@ -28,7 +28,7 @@ class ColumnConfigurationValidatorTest extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/svconnector', - 'typo3conf/ext/external_import' + 'typo3conf/ext/external_import', ]; /** @@ -55,9 +55,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 'foo' - ] - ] + 'field' => 'foo', + ], + ], ], 'Data type "array": using property "field" (positive integer)' => [ [ @@ -65,9 +65,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 42 - ] - ] + 'field' => 42, + ], + ], ], 'Data type "array": using property "field" (zero)' => [ [ @@ -75,9 +75,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 0 - ] - ] + 'field' => 0, + ], + ], ], 'Data type "array": using column property "value" (number)' => [ [ @@ -85,7 +85,7 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'value' => 17 + 'value' => 17, ], ], ], @@ -97,7 +97,7 @@ public function validConfigurationProvider(): array 'col' => [ 'transformations' => [ 10 => [ - 'value' => 17 + 'value' => 17, ], ], ], @@ -109,7 +109,7 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'value' => 'bar' + 'value' => 'bar', ], ], ], @@ -121,7 +121,7 @@ public function validConfigurationProvider(): array 'col' => [ 'transformations' => [ 10 => [ - 'value' => 'bar' + 'value' => 'bar', ], ], ], @@ -133,9 +133,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'arrayPath' => 'foo/bar' - ] - ] + 'arrayPath' => 'foo/bar', + ], + ], ], 'Data type "xml": using property "field" (string)' => [ [ @@ -143,9 +143,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 'foo' - ] - ] + 'field' => 'foo', + ], + ], ], 'Data type "xml": using column property "value" (number)' => [ [ @@ -153,9 +153,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'value' => 17 - ] - ] + 'value' => 17, + ], + ], ], 'Data type "xml": using transformations property "value" (number)' => [ [ @@ -165,7 +165,7 @@ public function validConfigurationProvider(): array 'col' => [ 'transformations' => [ 10 => [ - 'value' => 17 + 'value' => 17, ], ], ], @@ -177,7 +177,7 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'value' => 'bar' + 'value' => 'bar', ], ], ], @@ -189,7 +189,7 @@ public function validConfigurationProvider(): array 'col' => [ 'transformations' => [ 10 => [ - 'value' => 'bar' + 'value' => 'bar', ], ], ], @@ -201,9 +201,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 'baz' - ] - ] + 'field' => 'baz', + ], + ], ], 'Data type "xml": using property "xpath" (string)' => [ [ @@ -211,9 +211,9 @@ public function validConfigurationProvider(): array ], [ 'col' => [ - 'field' => 'hello' - ] - ] + 'field' => 'hello', + ], + ], ], 'Children definition' => [ // No need for a general configuration @@ -224,45 +224,45 @@ public function validConfigurationProvider(): array 'table' => 'foo', 'columns' => [ 'column1' => [ - 'value' => 'bar' + 'value' => 'bar', ], 'column2' => [ - 'field' => 'baz' - ] - ] - ] - ] - ] + 'field' => 'baz', + ], + ], + ], + ], + ], ], 'Substructure fields: valid structure and properties for "array" data type' => [ [ - 'data' => 'array' + 'data' => 'array', ], [ 'col' => [ 'field' => 'foo', 'substructureFields' => [ 'foo' => [ - 'arrayPath' => 'bar' - ] - ] - ] - ] + 'arrayPath' => 'bar', + ], + ], + ], + ], ], 'Substructure fields: valid structure and properties for "xml" data type' => [ [ - 'data' => 'xml' + 'data' => 'xml', ], [ 'col' => [ 'substructureFields' => [ 'foo' => [ - 'xpath' => 'bar' - ] - ] - ] - ] - ] + 'xpath' => 'bar', + ], + ], + ], + ], + ], ]; } @@ -293,49 +293,49 @@ public function invalidConfigurationProvider(): array return [ 'Data type "array": missing data-setting properties' => [ [ - 'data' => 'array' + 'data' => 'array', ], [], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Data type "xml": missing data-setting properties' => [ [ - 'data' => 'xml' + 'data' => 'xml', ], [], - AbstractMessage::NOTICE + AbstractMessage::NOTICE, ], 'Data type "array": conflicting data-setting properties' => [ [ - 'data' => 'array' + 'data' => 'array', ], [ 'col' => [ 'field' => 'foo', 'transformations' => [ 10 => [ - 'value' => 42 - ] - ] - ] + 'value' => 42, + ], + ], + ], ], - AbstractMessage::NOTICE + AbstractMessage::NOTICE, ], 'Data type "xml": conflicting data-setting properties' => [ [ - 'data' => 'xml' + 'data' => 'xml', ], [ 'col' => [ 'xpath' => 'item', 'transformations' => [ 10 => [ - 'value' => 42 - ] - ] - ] + 'value' => 42, + ], + ], + ], ], - AbstractMessage::NOTICE + AbstractMessage::NOTICE, ], 'Children definition: no "table" property' => [ // No need for a general configuration @@ -345,18 +345,18 @@ public function invalidConfigurationProvider(): array 'children' => [ 'columns' => [ 'column1' => [ - 'value' => 'bar' + 'value' => 'bar', ], 'column2' => [ - 'field' => 'baz' - ] + 'field' => 'baz', + ], ], 'controlColumnsForUpdate' => 'column1', - 'controlColumnsForDelete' => 'column1' - ] - ] + 'controlColumnsForDelete' => 'column1', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Children definition: no "columns" property' => [ // No need for a general configuration @@ -364,11 +364,11 @@ public function invalidConfigurationProvider(): array [ 'col' => [ 'children' => [ - 'table' => 'foo' - ] - ] + 'table' => 'foo', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Children definition: "columns" sub-property not an array' => [ // No need for a general configuration @@ -378,14 +378,14 @@ public function invalidConfigurationProvider(): array 'children' => [ 'table' => 'foo', 'columns' => [ - 'column1' => 'bar' + 'column1' => 'bar', ], 'controlColumnsForUpdate' => 'column1', - 'controlColumnsForDelete' => 'column1' - ] - ] + 'controlColumnsForDelete' => 'column1', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Children definition: wrong "columns" sub-property' => [ // No need for a general configuration @@ -396,15 +396,15 @@ public function invalidConfigurationProvider(): array 'table' => 'foo', 'columns' => [ 'column1' => [ - 'bar' => 'baz' - ] + 'bar' => 'baz', + ], ], 'controlColumnsForUpdate' => 'column1', - 'controlColumnsForDelete' => 'column1' - ] - ] + 'controlColumnsForDelete' => 'column1', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Children definition: wrong "controlColumnsForUpdate" sub-property' => [ // No need for a general configuration @@ -415,14 +415,14 @@ public function invalidConfigurationProvider(): array 'table' => 'foo', 'columns' => [ 'column1' => [ - 'bar' => 'baz' - ] + 'bar' => 'baz', + ], ], - 'controlColumnsForUpdate' => 'columnX' - ] - ] + 'controlColumnsForUpdate' => 'columnX', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Children definition: wrong "controlColumnsForDelete" sub-property' => [ // No need for a general configuration @@ -433,75 +433,75 @@ public function invalidConfigurationProvider(): array 'table' => 'foo', 'columns' => [ 'column1' => [ - 'bar' => 'baz' - ] + 'bar' => 'baz', + ], ], - 'controlColumnsForDelete' => 'columnX' - ] - ] + 'controlColumnsForDelete' => 'columnX', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Substructure fields: wrong structure' => [ [ - 'data' => 'array' + 'data' => 'array', ], [ 'col' => [ 'field' => 'foo', 'substructureFields' => [ - 'field' => 'foo' - ] - ] + 'field' => 'foo', + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Substructure fields: empty configuration for "array" data type' => [ [ - 'data' => 'array' + 'data' => 'array', ], [ 'col' => [ 'field' => 'foo', 'substructureFields' => [ - 'foo' => [] - ] - ] + 'foo' => [], + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Substructure fields: invalid properties for "array" data type' => [ [ - 'data' => 'array' + 'data' => 'array', ], [ 'col' => [ 'field' => 'foo', 'substructureFields' => [ 'foo' => [ - 'xpath' => 'bar' - ] - ] - ] + 'xpath' => 'bar', + ], + ], + ], ], - AbstractMessage::ERROR + AbstractMessage::ERROR, ], 'Substructure fields: invalid properties for "xml" data type' => [ [ - 'data' => 'xml' + 'data' => 'xml', ], [ 'col' => [ 'field' => 'foo', 'substructureFields' => [ 'foo' => [ - 'arrayPath' => 'bar' - ] - ] - ] + 'arrayPath' => 'bar', + ], + ], + ], ], - AbstractMessage::ERROR - ] + AbstractMessage::ERROR, + ], ]; } @@ -531,4 +531,4 @@ public function isValidRaisesMessageForInvalidConfiguration( serialize($this->subject->getResults()->getAll()) ); } -} \ No newline at end of file +} diff --git a/Tests/Functional/Validator/GeneralConfigurationValidatorTest.php b/Tests/Functional/Validator/GeneralConfigurationValidatorTest.php index c7add0bc..3303901f 100644 --- a/Tests/Functional/Validator/GeneralConfigurationValidatorTest.php +++ b/Tests/Functional/Validator/GeneralConfigurationValidatorTest.php @@ -43,12 +43,12 @@ public function setUp(): void parent::setUp(); // Localized validation messages need a global LanguageService object $GLOBALS['LANG'] = $this->getAccessibleMock( - LanguageService::class, - [], - [], - '', - // Don't call the original constructor to avoid a cascade of dependencies - false + LanguageService::class, + [], + [], + '', + // Don't call the original constructor to avoid a cascade of dependencies + false ); $this->subject = GeneralUtility::makeInstance(GeneralConfigurationValidator::class); @@ -61,25 +61,25 @@ public function validConfigurationProvider(): array [ 'data' => 'array', 'referenceUid' => 'external_id', - 'pid' => 12 - ] + 'pid' => 12, + ], ], 'Typical configuration for xml type (nodetype)' => [ [ 'data' => 'xml', 'nodetype' => 'foo', 'referenceUid' => 'external_id', - 'pid' => 12 - ] + 'pid' => 12, + ], ], 'Typical configuration for xml type (nodepath)' => [ [ 'data' => 'xml', 'nodepath' => '//foo', 'referenceUid' => 'external_id', - 'pid' => 12 - ] - ] + 'pid' => 12, + ], + ], ]; } @@ -105,27 +105,27 @@ public function invalidConfigurationProvider(): array return [ 'Missing data property' => [ [ - 'reference_uid' => 'external_id' - ] + 'reference_uid' => 'external_id', + ], ], 'Invalid data property' => [ [ 'data' => 'foo', - 'reference_uid' => 'external_id' - ] + 'reference_uid' => 'external_id', + ], ], 'Invalid connector property' => [ [ 'data' => 'array', 'reference_uid' => 'external_id', - 'connector' => uniqid('', true) - ] + 'connector' => uniqid('', true), + ], ], 'Missing reference_uid property' => [ [ - 'data' => 'array' - ] - ] + 'data' => 'array', + ], + ], ]; } @@ -150,13 +150,13 @@ public function invalidDataPropertyConfigurationProvider(): array { return [ 'Missing data property' => [ - [] + [], ], 'Invalid data property' => [ [ - 'data' => 'foo' - ] - ] + 'data' => 'foo', + ], + ], ]; } @@ -190,7 +190,7 @@ public function validateConnectorPropertyWithInvalidValueRaisesError(): void 'tt_content', [ // Some random connector name - 'connector' => uniqid('', true) + 'connector' => uniqid('', true), ] ) ); @@ -206,14 +206,14 @@ public function invalidDataHandlerPropertyConfigurationProvider(): array return [ 'Not existing class' => [ [ - 'dataHandler' => 'Cobweb\\ExternalImport\\' . time() - ] + 'dataHandler' => 'Cobweb\\ExternalImport\\' . time(), + ], ], 'Class not implementing proper interface' => [ [ - 'dataHandler' => Importer::class - ] - ] + 'dataHandler' => Importer::class, + ], + ], ]; } @@ -246,7 +246,7 @@ public function validateNodetypePropertyForXmlDataWithEmptyValueRaisesError(): v $this->prepareConfigurationObject( 'tt_content', [ - 'data' => 'xml' + 'data' => 'xml', ] ) ); @@ -284,7 +284,7 @@ public function validatePriorityPropertyWithEmptyValueRaisesNotice(): void $this->prepareConfigurationObject( 'tt_content', [ - 'connector' => 'foo' + 'connector' => 'foo', ] ) ); @@ -306,7 +306,7 @@ public function validatePidPropertyWithEmptyValueForRootTableRaisesNotice(): voi [ // NOTE: normally, configuration is parsed by the ConfigurationRepository and pid would // be set to 0 if missing from configuration - 'pid' => 0 + 'pid' => 0, ] ) ); @@ -325,21 +325,21 @@ public function invalidPidPropertyConfigurationProvider(): array [ // NOTE: normally, configuration is parsed by the ConfigurationRepository and pid would // be set to 0 if missing from configuration - 'pid' => 0 - ] + 'pid' => 0, + ], ], 'Negative pid' => [ 'tt_content', [ - 'pid' => -12 - ] + 'pid' => -12, + ], ], 'Positive pid, root table' => [ 'be_users', [ - 'pid' => 12 - ] - ] + 'pid' => 12, + ], + ], ]; } @@ -373,7 +373,7 @@ public function validateUseColumnIndexPropertyWithInvalidValueRaisesError(): voi $this->prepareConfigurationObject( 'tt_content', [ - 'useColumnIndex' => 'foo' + 'useColumnIndex' => 'foo', ] ) ); @@ -393,7 +393,7 @@ public function validateColumnsOrderPropertyWithDuplicateValuesRaisesNotice(): v $this->prepareConfigurationObject( 'tt_content', [ - 'columnsOrder' => 'bb, aa, aa' + 'columnsOrder' => 'bb, aa, aa', ], [ 'aa' => [ @@ -427,4 +427,4 @@ protected function prepareConfigurationObject(string $table, array $configuratio $configurationObject->setColumnConfiguration($columnConfiguration); return $configurationObject; } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/ChildrenConfigurationTest.php b/Tests/Unit/Domain/Model/ChildrenConfigurationTest.php index 16ebd1e8..3ba260be 100644 --- a/Tests/Unit/Domain/Model/ChildrenConfigurationTest.php +++ b/Tests/Unit/Domain/Model/ChildrenConfigurationTest.php @@ -33,7 +33,6 @@ public function setUp(): void /** * @test - * @return void */ public function getBaseDataInitiallyReturnsEmptyArray(): void { @@ -45,7 +44,6 @@ public function getBaseDataInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function setBaseDataSetsDataArray(): void { @@ -62,21 +60,21 @@ public function propertyProvider(): array 'empty base data' => [ 'baseData' => [], 'property' => 'table', - 'result' => null + 'result' => null, ], 'matching base data' => [ 'baseData' => [ - 'table' => 'foo' + 'table' => 'foo', ], 'property' => 'table', - 'result' => 'foo' + 'result' => 'foo', ], 'non-matching base data' => [ 'baseData' => [ - 'table' => 'foo' + 'table' => 'foo', ], 'property' => 'bar', - 'result' => null + 'result' => null, ], ]; } @@ -87,7 +85,6 @@ public function propertyProvider(): array * @param array $baseData * @param string $property * @param $result - * @return void */ public function getBaseDataPropertyReturnsValueOrNull(array $baseData, string $property, $result): void { @@ -100,7 +97,6 @@ public function getBaseDataPropertyReturnsValueOrNull(array $baseData, string $p /** * @test - * @return void */ public function getControlColumnsForDeleteInitiallyReturnsEmptyArray(): void { @@ -112,7 +108,6 @@ public function getControlColumnsForDeleteInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function setControlColumnsForDeleteSetsArray(): void { @@ -125,7 +120,6 @@ public function setControlColumnsForDeleteSetsArray(): void /** * @test - * @return void */ public function getControlColumnsForUpdateInitiallyReturnsEmptyArray(): void { @@ -137,7 +131,6 @@ public function getControlColumnsForUpdateInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function setControlColumnsForUpdateSetsArray(): void { @@ -150,7 +143,6 @@ public function setControlColumnsForUpdateSetsArray(): void /** * @test - * @return void */ public function isDeleteAllowedInitiallyReturnsTrue(): void { @@ -161,7 +153,6 @@ public function isDeleteAllowedInitiallyReturnsTrue(): void /** * @test - * @return void */ public function setDeleteAllowedInitiallySetsBoolean(): void { @@ -173,7 +164,6 @@ public function setDeleteAllowedInitiallySetsBoolean(): void /** * @test - * @return void */ public function isInsertAllowedInitiallyReturnsTrue(): void { @@ -184,7 +174,6 @@ public function isInsertAllowedInitiallyReturnsTrue(): void /** * @test - * @return void */ public function setInsertAllowedInitiallySetsBoolean(): void { @@ -196,7 +185,6 @@ public function setInsertAllowedInitiallySetsBoolean(): void /** * @test - * @return void */ public function isUpdateAllowedInitiallyReturnsTrue(): void { @@ -207,7 +195,6 @@ public function isUpdateAllowedInitiallyReturnsTrue(): void /** * @test - * @return void */ public function setUpdateAllowedInitiallySetsBoolean(): void { @@ -240,7 +227,6 @@ public function allowedOperationsProvider(): array * @dataProvider allowedOperationsProvider * @param string $operation * @param bool $flag - * @return void */ public function setAllowedOperationSetExpectedFlag(string $operation, bool $flag): void { @@ -264,7 +250,6 @@ public function setAllowedOperationSetExpectedFlag(string $operation, bool $flag /** * @test - * @return void */ public function getSortingInitiallyReturnsEmptyArray(): void { @@ -276,7 +261,6 @@ public function getSortingInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function setSortingSetsArray(): void { @@ -294,4 +278,4 @@ public function setSortingSetsArray(): void $this->subject->getSorting() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/ConfigurationKeyTest.php b/Tests/Unit/Domain/Model/ConfigurationKeyTest.php index e7370f44..25c81c6d 100644 --- a/Tests/Unit/Domain/Model/ConfigurationKeyTest.php +++ b/Tests/Unit/Domain/Model/ConfigurationKeyTest.php @@ -1,4 +1,5 @@ [ 'table' => 'tx_foo', 'index' => 1, - 'key' => 'tx_foo***1' + 'key' => 'tx_foo***1', ], 'standard table name, numerical index with value 0' => [ 'table' => 'tx_foo', 'index' => 0, - 'key' => 'tx_foo***0' + 'key' => 'tx_foo***0', ], 'standard table name, string index' => [ 'table' => 'tx_foo', 'index' => 'bar', - 'key' => 'tx_foo***bar' + 'key' => 'tx_foo***bar', ], 'table name with hyphen, string index' => [ 'table' => 'tx-foo', 'index' => 'bar', - 'key' => 'tx-foo***bar' + 'key' => 'tx-foo***bar', ], 'group name' => [ 'table' => 'group:foo', 'index' => '', - 'key' => 'group:foo' + 'key' => 'group:foo', ], 'all tables' => [ 'table' => 'all', 'index' => '', - 'key' => 'all' - ] + 'key' => 'all', + ], ]; } @@ -121,4 +120,4 @@ public function setTableAndIndexSetsConfigurationKey(string $table, $index, stri $this->subject->setTableAndIndex($table, (string)$index); self::assertEquals($key, $this->subject->getConfigurationKey()); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/ConfigurationTest.php b/Tests/Unit/Domain/Model/ConfigurationTest.php index ac075b33..cab19964 100644 --- a/Tests/Unit/Domain/Model/ConfigurationTest.php +++ b/Tests/Unit/Domain/Model/ConfigurationTest.php @@ -44,8 +44,8 @@ public function setUp(): void public function getAdditionalFieldsInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getAdditionalFields() + [], + $this->subject->getAdditionalFields() ); } @@ -55,8 +55,8 @@ public function getAdditionalFieldsInitiallyReturnsEmptyArray(): void public function getColumnConfigurationInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getColumnConfiguration() + [], + $this->subject->getColumnConfiguration() ); } @@ -66,8 +66,8 @@ public function getColumnConfigurationInitiallyReturnsEmptyArray(): void public function getConfigurationForColumnInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getConfigurationForColumn('foo') + [], + $this->subject->getConfigurationForColumn('foo') ); } @@ -77,7 +77,7 @@ public function getConfigurationForColumnInitiallyReturnsEmptyArray(): void public function getConnectorInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getConnector() + $this->subject->getConnector() ); } @@ -87,8 +87,8 @@ public function getConnectorInitiallyReturnsNull(): void public function getCountAdditionalFieldsInitiallyReturnsZero(): void { self::assertSame( - 0, - $this->subject->getCountAdditionalFields() + 0, + $this->subject->getCountAdditionalFields() ); } @@ -98,8 +98,8 @@ public function getCountAdditionalFieldsInitiallyReturnsZero(): void public function getGenerallConfigurationInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getGeneralConfiguration() + [], + $this->subject->getGeneralConfiguration() ); } @@ -109,7 +109,7 @@ public function getGenerallConfigurationInitiallyReturnsEmptyArray(): void public function getGenerallConfigurationPropertyInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getGeneralConfigurationProperty('foo') + $this->subject->getGeneralConfigurationProperty('foo') ); } @@ -119,7 +119,7 @@ public function getGenerallConfigurationPropertyInitiallyReturnsNull(): void public function getIndexInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getIndex() + $this->subject->getIndex() ); } @@ -129,8 +129,8 @@ public function getIndexInitiallyReturnsNull(): void public function getStepsInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getSteps() + [], + $this->subject->getSteps() ); } @@ -140,7 +140,7 @@ public function getStepsInitiallyReturnsEmptyArray(): void public function hasParametersForStepInitiallyReturnsFalse(): void { self::assertFalse( - $this->subject->hasParametersForStep(StoreDataStep::class) + $this->subject->hasParametersForStep(StoreDataStep::class) ); } @@ -150,8 +150,8 @@ public function hasParametersForStepInitiallyReturnsFalse(): void public function getParametersForStepInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getParametersForStep(StoreDataStep::class) + [], + $this->subject->getParametersForStep(StoreDataStep::class) ); } @@ -162,12 +162,12 @@ public function setParametersForStepSetsParameters(): void { $parameters = ['foo', 'bar' => 'baz']; $this->subject->setParametersForStep( - $parameters, - StoreDataStep::class + $parameters, + StoreDataStep::class ); self::assertSame( - $parameters, - $this->subject->getParametersForStep(StoreDataStep::class) + $parameters, + $this->subject->getParametersForStep(StoreDataStep::class) ); } @@ -177,7 +177,7 @@ public function setParametersForStepSetsParameters(): void public function getStoragePidInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getStoragePid() + $this->subject->getStoragePid() ); } @@ -187,7 +187,7 @@ public function getStoragePidInitiallyReturnsNull(): void public function getTableInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getTable() + $this->subject->getTable() ); } @@ -198,10 +198,10 @@ public function ctrlConfigurationProvider(): array [ 'connector' => 'feed', 'pid' => 42, - 'additionalFields' => 'foo,bar' + 'additionalFields' => 'foo,bar', ], - 42 - ] + 42, + ], ]; } @@ -215,16 +215,16 @@ public function setGeneralConfigurationSetsGeneralConfigurationAndMore(array $co { $this->subject->setGeneralConfiguration($configuration); self::assertSame( - $configuration, - $this->subject->getGeneralConfiguration() + $configuration, + $this->subject->getGeneralConfiguration() ); self::assertEquals( - $pid, - $this->subject->getStoragePid() + $pid, + $this->subject->getStoragePid() ); self::assertSame( - Importer::SYNCHRONYZE_DATA_STEPS, - $this->subject->getSteps() + Importer::SYNCHRONYZE_DATA_STEPS, + $this->subject->getSteps() ); } @@ -238,52 +238,52 @@ public function columnConfigurationProvider(): array 'field' => 'bar', 'transformations' => [ 20 => [ - 'value' => 3 + 'value' => 3, ], 10 => [ - 'value' => 4 - ] - ] - ] + 'value' => 4, + ], + ], + ], ], 'foo', [ 'field' => 'bar', 'transformations' => [ 10 => [ - 'value' => 4 + 'value' => 4, ], 20 => [ - 'value' => 3 - ] - ] - ] + 'value' => 3, + ], + ], + ], ], 'configuration with additional fields' => [ [ 'baz' => [ - 'field' => 'baz' - ] + 'field' => 'baz', + ], ], [ 'foo' => [ 'field' => 'bar', 'transformations' => [ 20 => [ - 'value' => 3 + 'value' => 3, ], 10 => [ - 'value' => 4 - ] - ] - ] + 'value' => 4, + ], + ], + ], ], 'baz', [ 'field' => 'baz', - Configuration::DO_NOT_SAVE_KEY => true - ] - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], + ], ]; } @@ -302,8 +302,8 @@ public function setColumnConfigurationSetsConfigurationAndSortsTransformations(a } $this->subject->setColumnConfiguration($columnConfiguration); self::assertSame( - $processedConfiguration, - $this->subject->getConfigurationForColumn($columnName) + $processedConfiguration, + $this->subject->getConfigurationForColumn($columnName) ); } @@ -314,23 +314,23 @@ public function setAdditionalFieldsSetsFieldsAndCount(): void { $additionalFields = [ 'foo' => [ - 'field' => 'foo' + 'field' => 'foo', ], 'bar' => [ - 'field' => 'bar' - ] + 'field' => 'bar', + ], ]; $this->subject->setAdditionalFields($additionalFields); // When set, additional fields get extra data attached to them $additionalFields['foo'][Configuration::DO_NOT_SAVE_KEY] = true; $additionalFields['bar'][Configuration::DO_NOT_SAVE_KEY] = true; self::assertSame( - $additionalFields, - $this->subject->getAdditionalFields() + $additionalFields, + $this->subject->getAdditionalFields() ); self::assertEquals( - count($additionalFields), - $this->subject->getCountAdditionalFields() + count($additionalFields), + $this->subject->getCountAdditionalFields() ); } @@ -350,8 +350,8 @@ public function setConnectorSetsConnector(): void ); $this->subject->setConnector($connector); self::assertSame( - $connector, - $this->subject->getConnector() + $connector, + $this->subject->getConnector() ); } @@ -363,8 +363,8 @@ public function setCountAdditionalFieldsSetsCount(): void $countAdditionalFields = 2; $this->subject->setCountAdditionalFields($countAdditionalFields); self::assertEquals( - $countAdditionalFields, - $this->subject->getCountAdditionalFields() + $countAdditionalFields, + $this->subject->getCountAdditionalFields() ); } @@ -376,8 +376,8 @@ public function setIndexSetsIndex(): void $index = 2; $this->subject->setIndex($index); self::assertEquals( - $index, - $this->subject->getIndex() + $index, + $this->subject->getIndex() ); } @@ -389,8 +389,8 @@ public function setStoragePidSetsPid(): void $storagePid = 2; $this->subject->setStoragePid($storagePid); self::assertEquals( - $storagePid, - $this->subject->getStoragePid() + $storagePid, + $this->subject->getStoragePid() ); } @@ -402,8 +402,8 @@ public function setTableSetsTable(): void $table = 'tx_foo_bar'; $this->subject->setTable($table); self::assertEquals( - $table, - $this->subject->getTable() + $table, + $this->subject->getTable() ); } @@ -494,7 +494,6 @@ public function sortColumnsProvider(): array * @param array $columns * @param string $order * @param array $orderedColumns - * @return void */ public function sortColumnsSortsColumns(array $columns, string $order, array $orderedColumns): void { @@ -506,4 +505,4 @@ public function sortColumnsSortsColumns(array $columns, string $order, array $or $orderedColumns ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/DataTest.php b/Tests/Unit/Domain/Model/DataTest.php index 1dbf7f25..fd398538 100644 --- a/Tests/Unit/Domain/Model/DataTest.php +++ b/Tests/Unit/Domain/Model/DataTest.php @@ -1,4 +1,5 @@ subject->setRawData('foo'); self::assertSame( - 'foo', - $this->subject->getRawData() + 'foo', + $this->subject->getRawData() ); } @@ -62,8 +60,8 @@ public function setRawDataSetsRawData(): void public function getExtraDataInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getExtraData() + [], + $this->subject->getExtraData() ); } @@ -75,8 +73,8 @@ public function setExtraDataOverwritesExistingExtraData(): void $this->subject->setExtraData(['foo']); $this->subject->setExtraData(['bar']); self::assertSame( - ['bar'], - $this->subject->getExtraData() + ['bar'], + $this->subject->getExtraData() ); } @@ -88,8 +86,8 @@ public function addExtraDataAddsExtraData(): void $this->subject->addExtraData('entry1', 'foo'); $this->subject->addExtraData('entry2', 'bar'); self::assertSame( - ['entry1' => 'foo', 'entry2' => 'bar'], - $this->subject->getExtraData() + ['entry1' => 'foo', 'entry2' => 'bar'], + $this->subject->getExtraData() ); } @@ -99,8 +97,8 @@ public function addExtraDataAddsExtraData(): void public function getRecordsInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getRecords() + [], + $this->subject->getRecords() ); } @@ -111,8 +109,8 @@ public function setRecordsSetsRecords(): void { $this->subject->setRecords([1, 2]); self::assertSame( - [1, 2], - $this->subject->getRecords() + [1, 2], + $this->subject->getRecords() ); } @@ -136,4 +134,4 @@ public function setDownloadableSetsBooleanValue(): void $this->subject->isDownloadable() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/Dto/ChildrenSortingTest.php b/Tests/Unit/Domain/Model/Dto/ChildrenSortingTest.php index 7b80e16b..9e1808a4 100644 --- a/Tests/Unit/Domain/Model/Dto/ChildrenSortingTest.php +++ b/Tests/Unit/Domain/Model/Dto/ChildrenSortingTest.php @@ -50,9 +50,9 @@ public function hasSortingInformationProvider(): array return [ 'one table - empty' => [ 'structure' => [ - 'foo' => [] + 'foo' => [], ], - 'result' => false + 'result' => false, ], 'one table - one item' => [ 'structure' => [ @@ -60,11 +60,11 @@ public function hasSortingInformationProvider(): array [ 3, 'sorting', - 1 - ] - ] + 1, + ], + ], ], - 'result' => true + 'result' => true, ], 'two tables - one empty, one not' => [ 'structure' => [ @@ -72,13 +72,13 @@ public function hasSortingInformationProvider(): array [ 3, 'sorting', - 1 - ] + 1, + ], ], - 'bar' => [] + 'bar' => [], ], - 'result' => true - ] + 'result' => true, + ], ]; } @@ -133,9 +133,9 @@ public function addSortingInformationExpandsArray(): void [ 'foo' => [ 2 => [ - 'sorting' => 1 - ] - ] + 'sorting' => 1, + ], + ], ], $this->subject->getSortingInformation() ); @@ -145,12 +145,12 @@ public function addSortingInformationExpandsArray(): void [ 'foo' => [ 2 => [ - 'sorting' => 1 + 'sorting' => 1, ], 3 => [ - 'sorting' => 2 - ] - ] + 'sorting' => 2, + ], + ], ], $this->subject->getSortingInformation() ); @@ -159,17 +159,17 @@ public function addSortingInformationExpandsArray(): void [ 'foo' => [ 2 => [ - 'sorting' => 1 + 'sorting' => 1, ], 3 => [ - 'sorting' => 2 - ] + 'sorting' => 2, + ], ], 'bar' => [ 1 => [ - 'sorting' => 1 - ] - ] + 'sorting' => 1, + ], + ], ], $this->subject->getSortingInformation() ); @@ -187,12 +187,12 @@ public function replaceIdReplacesChildId(): void [ 'foo' => [ 3 => [ - 'sorting' => 2 + 'sorting' => 2, ], 12 => [ - 'sorting' => 1 - ] - ] + 'sorting' => 1, + ], + ], ], $this->subject->getSortingInformation() ); @@ -211,24 +211,24 @@ public function replaceAllNewIdsReplacesNewMarkers(): void $this->subject->addSortingInformation('foo', 3, 'sorting', 2); $this->subject->replaceAllNewIds( [ - 'NEW123.45' => 17 + 'NEW123.45' => 17, ] ); self::assertSame( [ 'foo' => [ 'tempKey' => [ - 'sorting' => 4 + 'sorting' => 4, ], 3 => [ - 'sorting' => 2 + 'sorting' => 2, ], 17 => [ - 'sorting' => 1 - ] - ] + 'sorting' => 1, + ], + ], ], $this->subject->getSortingInformation() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/Dto/QueryParametersTest.php b/Tests/Unit/Domain/Model/Dto/QueryParametersTest.php index c94ea4ee..e9bdbbda 100644 --- a/Tests/Unit/Domain/Model/Dto/QueryParametersTest.php +++ b/Tests/Unit/Domain/Model/Dto/QueryParametersTest.php @@ -22,8 +22,6 @@ /** * Test case for the QueryParameters model object. - * - * @package Cobweb\ExternalImport\Tests\Unit\Utility */ class QueryParametersTest extends UnitTestCase { @@ -44,8 +42,8 @@ public function setUp(): void public function getDrawInitiallyReturnsZero(): void { self::assertSame( - 0, - $this->subject->getDraw() + 0, + $this->subject->getDraw() ); } @@ -55,8 +53,8 @@ public function getDrawInitiallyReturnsZero(): void public function getSearchInitiallyReturnsEmptyString(): void { self::assertSame( - '', - $this->subject->getSearch() + '', + $this->subject->getSearch() ); } @@ -66,8 +64,8 @@ public function getSearchInitiallyReturnsEmptyString(): void public function getSearchColumnsInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getSearchColumns() + [], + $this->subject->getSearchColumns() ); } @@ -77,8 +75,8 @@ public function getSearchColumnsInitiallyReturnsEmptyArray(): void public function getLimitInitiallyReturnsZero(): void { self::assertSame( - 0, - $this->subject->getLimit() + 0, + $this->subject->getLimit() ); } @@ -88,8 +86,8 @@ public function getLimitInitiallyReturnsZero(): void public function getOffsetInitiallyReturnsZero(): void { self::assertSame( - 0, - $this->subject->getOffset() + 0, + $this->subject->getOffset() ); } @@ -99,8 +97,8 @@ public function getOffsetInitiallyReturnsZero(): void public function getOrderInitiallyReturnsEmptyString(): void { self::assertSame( - '', - $this->subject->getOrder() + '', + $this->subject->getOrder() ); } @@ -110,8 +108,8 @@ public function getOrderInitiallyReturnsEmptyString(): void public function getDirectionInitiallyReturnsDesc(): void { self::assertSame( - QueryInterface::ORDER_DESCENDING, - $this->subject->getDirection() + QueryInterface::ORDER_DESCENDING, + $this->subject->getDirection() ); } @@ -122,8 +120,8 @@ public function setDrawSetsValue(): void { $this->subject->setDraw(2); self::assertSame( - 2, - $this->subject->getDraw() + 2, + $this->subject->getDraw() ); } @@ -134,8 +132,8 @@ public function setSearchSetsValue(): void { $this->subject->setSearch('foo'); self::assertSame( - 'foo', - $this->subject->getSearch() + 'foo', + $this->subject->getSearch() ); } @@ -145,24 +143,24 @@ public function setSearchSetsValue(): void public function setSearchColumnsKeepsOnlySearchableColumns(): void { $this->subject->setSearchColumns( - [ - [ - 'searchable' => 'true', - 'name' => 'foo' - ], - [ - 'searchable' => 'false', - 'name' => 'not me' - ], - [ - 'searchable' => 'true', - 'name' => 'bar' - ] - ] + [ + [ + 'searchable' => 'true', + 'name' => 'foo', + ], + [ + 'searchable' => 'false', + 'name' => 'not me', + ], + [ + 'searchable' => 'true', + 'name' => 'bar', + ], + ] ); self::assertSame( - ['foo', 'bar'], - $this->subject->getSearchColumns() + ['foo', 'bar'], + $this->subject->getSearchColumns() ); } @@ -173,8 +171,8 @@ public function setLimitSetsValue(): void { $this->subject->setLimit(2); self::assertSame( - 2, - $this->subject->getLimit() + 2, + $this->subject->getLimit() ); } @@ -185,8 +183,8 @@ public function setOffsetSetsValue(): void { $this->subject->setOffset(2); self::assertSame( - 2, - $this->subject->getOffset() + 2, + $this->subject->getOffset() ); } @@ -197,8 +195,8 @@ public function setOrderSetsValue(): void { $this->subject->setOrder('foo'); self::assertSame( - 'foo', - $this->subject->getOrder() + 'foo', + $this->subject->getOrder() ); } @@ -207,20 +205,20 @@ public function directionValueProvider(): array return [ 'ASC is ASC' => [ 'ASC', - QueryInterface::ORDER_ASCENDING + QueryInterface::ORDER_ASCENDING, ], 'DESC is DESC' => [ 'DESC', - QueryInterface::ORDER_DESCENDING + QueryInterface::ORDER_DESCENDING, ], 'asc is DESC' => [ 'asc', - QueryInterface::ORDER_DESCENDING + QueryInterface::ORDER_DESCENDING, ], 'wathever is DESC' => [ 'foo', - QueryInterface::ORDER_DESCENDING - ] + QueryInterface::ORDER_DESCENDING, + ], ]; } @@ -234,8 +232,8 @@ public function setDirectionSetsSanitizedValue(string $value, string $expected): { $this->subject->setDirection($value); self::assertSame( - $expected, - $this->subject->getDirection() + $expected, + $this->subject->getDirection() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/LogTest.php b/Tests/Unit/Domain/Model/LogTest.php index b5cc8e59..b7400d7f 100644 --- a/Tests/Unit/Domain/Model/LogTest.php +++ b/Tests/Unit/Domain/Model/LogTest.php @@ -1,4 +1,5 @@ subject->getStatus() + AbstractMessage::NOTICE, + $this->subject->getStatus() ); } @@ -56,8 +54,8 @@ public function setStatusSetsStatus(): void { $this->subject->setStatus(3); self::assertEquals( - 3, - $this->subject->getStatus() + 3, + $this->subject->getStatus() ); } @@ -76,11 +74,11 @@ public function setCrdateSetsCrdate(): void { $now = new \DateTime(); $this->subject->setCrdate( - $now + $now ); self::assertEquals( - $now->getTimestamp(), - $this->subject->getCrdate()->getTimestamp() + $now->getTimestamp(), + $this->subject->getCrdate()->getTimestamp() ); } @@ -100,11 +98,11 @@ public function setCruserIdSetsCruserId(): void $user = new BackendUser(); $user->setUserName('ford.escort'); $this->subject->setCruserId( - $user + $user ); self::assertEquals( - 'ford.escort', - $this->subject->getCruserId()->getUserName() + 'ford.escort', + $this->subject->getCruserId()->getUserName() ); } @@ -114,8 +112,8 @@ public function setCruserIdSetsCruserId(): void public function getConfigurationInitiallyReturnsEmptyString(): void { self::assertSame( - '', - $this->subject->getConfiguration() + '', + $this->subject->getConfiguration() ); } @@ -126,8 +124,8 @@ public function setConfigurationSetsConfiguration(): void { $this->subject->setConfiguration('foo'); self::assertSame( - 'foo', - $this->subject->getConfiguration() + 'foo', + $this->subject->getConfiguration() ); } @@ -137,8 +135,8 @@ public function setConfigurationSetsConfiguration(): void public function getContextInitiallyReturnsEmptyString(): void { self::assertSame( - '', - $this->subject->getContext() + '', + $this->subject->getContext() ); } @@ -149,8 +147,8 @@ public function setContextSetsContext(): void { $this->subject->setContext('foo'); self::assertSame( - 'foo', - $this->subject->getContext() + 'foo', + $this->subject->getContext() ); } @@ -160,8 +158,8 @@ public function setContextSetsContext(): void public function getMessageInitiallyReturnsEmptyString(): void { self::assertSame( - '', - $this->subject->getMessage() + '', + $this->subject->getMessage() ); } @@ -172,8 +170,8 @@ public function setMessageSetsMessage(): void { $this->subject->setMessage('foo'); self::assertSame( - 'foo', - $this->subject->getMessage() + 'foo', + $this->subject->getMessage() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Model/ProcessedConfigurationTest.php b/Tests/Unit/Domain/Model/ProcessedConfigurationTest.php index 01bcc6bc..00fa5908 100644 --- a/Tests/Unit/Domain/Model/ProcessedConfigurationTest.php +++ b/Tests/Unit/Domain/Model/ProcessedConfigurationTest.php @@ -34,7 +34,6 @@ public function setUp(): void /** * @test - * @return void */ public function getFieldsExcludedFromInsertsInitiallyReturnsEmptyArray(): void { @@ -46,7 +45,6 @@ public function getFieldsExcludedFromInsertsInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function addFieldExcludedFromInsertsAddsColumn(): void { @@ -64,7 +62,6 @@ public function addFieldExcludedFromInsertsAddsColumn(): void /** * @test - * @return void */ public function setFieldsExcludedFromInsertsSetsArray(): void { @@ -77,7 +74,6 @@ public function setFieldsExcludedFromInsertsSetsArray(): void /** * @test - * @return void */ public function getFieldsExcludedFromUpdatesInitiallyReturnsEmptyArray(): void { @@ -89,7 +85,6 @@ public function getFieldsExcludedFromUpdatesInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function addFieldExcludedFromUpdatesAddsColumn(): void { @@ -107,7 +102,6 @@ public function addFieldExcludedFromUpdatesAddsColumn(): void /** * @test - * @return void */ public function setFieldsExcludedFromUpdatesSetsArray(): void { @@ -120,7 +114,6 @@ public function setFieldsExcludedFromUpdatesSetsArray(): void /** * @test - * @return void */ public function getChildColumnsInitiallyReturnsEmptyArray(): void { @@ -132,7 +125,6 @@ public function getChildColumnsInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function addChildColumnAddsChildrenConfigurationObject(): void { @@ -154,7 +146,6 @@ public function addChildColumnAddsChildrenConfigurationObject(): void /** * @test - * @return void */ public function setChildColumnsSetsChildrenConfigurationArrayt(): void { @@ -171,7 +162,6 @@ public function setChildColumnsSetsChildrenConfigurationArrayt(): void /** * @test - * @return void */ public function hasChildColumnsInitiallyReturnsFalse(): void { @@ -182,7 +172,6 @@ public function hasChildColumnsInitiallyReturnsFalse(): void /** * @test - * @return void */ public function hasChildColumnsReturnsTrueAfterAddingColumn(): void { @@ -197,7 +186,6 @@ public function hasChildColumnsReturnsTrueAfterAddingColumn(): void /** * @test - * @return void */ public function getNullableColumnsInitiallyReturnsEmptyArray(): void { @@ -209,7 +197,6 @@ public function getNullableColumnsInitiallyReturnsEmptyArray(): void /** * @test - * @return void */ public function setNullableColumnsSetsColumnsList(): void { @@ -222,7 +209,6 @@ public function setNullableColumnsSetsColumnsList(): void /** * @test - * @return void */ public function addNullableColumnAddsColumnToList(): void { @@ -236,7 +222,6 @@ public function addNullableColumnAddsColumnToList(): void /** * @test - * @return void */ public function isNullableColumnReturnsBoolean(): void { @@ -248,4 +233,4 @@ public function isNullableColumnReturnsBoolean(): void $this->subject->isNullableColumn('baz') ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Domain/Repository/TemporaryKeyRepositoryTest.php b/Tests/Unit/Domain/Repository/TemporaryKeyRepositoryTest.php index 996cc270..f7e4375a 100644 --- a/Tests/Unit/Domain/Repository/TemporaryKeyRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/TemporaryKeyRepositoryTest.php @@ -1,4 +1,5 @@ subject->hasTemporaryKey('foo', 'bar') + $this->subject->hasTemporaryKey('foo', 'bar') ); } @@ -54,12 +52,12 @@ public function hasTemporaryKeyInitiallyReturnsFalse(): void public function hasTemporaryKeyReturnsTrueIfKeyExists(): void { $this->subject->addTemporaryKey( - 'foo', - $this->subject->generateTemporaryKey(), - 'bar' + 'foo', + $this->subject->generateTemporaryKey(), + 'bar' ); self::assertTrue( - $this->subject->hasTemporaryKey('foo', 'bar') + $this->subject->hasTemporaryKey('foo', 'bar') ); } @@ -69,8 +67,8 @@ public function hasTemporaryKeyReturnsTrueIfKeyExists(): void public function getTemporaryKeysInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getTemporaryKeys() + [], + $this->subject->getTemporaryKeys() ); } @@ -81,25 +79,25 @@ public function getTemporaryKeysReturnsArrayOfKeys(): void { $this->subject->resetForcedTemporaryKeySerial(); $this->subject->addTemporaryKey( - 1, - $this->subject->generateTemporaryKey(), - 'foo' + 1, + $this->subject->generateTemporaryKey(), + 'foo' ); $this->subject->addTemporaryKey( - 2, - $this->subject->generateTemporaryKey(), - 'bar' + 2, + $this->subject->generateTemporaryKey(), + 'bar' ); self::assertSame( - [ - 'foo' => [ - 1 => 'NEW1' - ], - 'bar' => [ - 2 => 'NEW2' - ] - ], - $this->subject->getTemporaryKeys() + [ + 'foo' => [ + 1 => 'NEW1', + ], + 'bar' => [ + 2 => 'NEW2', + ], + ], + $this->subject->getTemporaryKeys() ); } @@ -110,12 +108,12 @@ public function generateTemporaryKeyGeneratesSequenceInTestMode(): void { $this->subject->resetForcedTemporaryKeySerial(); self::assertEquals( - 'NEW1', - $this->subject->generateTemporaryKey() + 'NEW1', + $this->subject->generateTemporaryKey() ); self::assertEquals( - 'NEW2', - $this->subject->generateTemporaryKey() + 'NEW2', + $this->subject->generateTemporaryKey() ); } @@ -125,7 +123,7 @@ public function generateTemporaryKeyGeneratesSequenceInTestMode(): void public function getTemporaryKeyForValueInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getTemporaryKeyForValue('foo', 'bar') + $this->subject->getTemporaryKeyForValue('foo', 'bar') ); } @@ -136,22 +134,22 @@ public function getTemporaryKeyForValueReturnsExpectedKeyForValueAndTable(): voi { $this->subject->resetForcedTemporaryKeySerial(); $this->subject->addTemporaryKey( - 1, - $this->subject->generateTemporaryKey(), - 'foo' + 1, + $this->subject->generateTemporaryKey(), + 'foo' ); $this->subject->addTemporaryKey( - 2, - $this->subject->generateTemporaryKey(), - 'bar' + 2, + $this->subject->generateTemporaryKey(), + 'bar' ); self::assertEquals( - 'NEW1', - $this->subject->getTemporaryKeyForValue(1, 'foo') + 'NEW1', + $this->subject->getTemporaryKeyForValue(1, 'foo') ); self::assertEquals( - 'NEW2', - $this->subject->getTemporaryKeyForValue(2, 'bar') + 'NEW2', + $this->subject->getTemporaryKeyForValue(2, 'bar') ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/CmdmapPostprocessEventTest.php b/Tests/Unit/Event/CmdmapPostprocessEventTest.php index 0416348d..c0e1bb96 100644 --- a/Tests/Unit/Event/CmdmapPostprocessEventTest.php +++ b/Tests/Unit/Event/CmdmapPostprocessEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the InsertRecordPreprocessEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class CmdmapPostprocessEventTest extends UnitTestCase { @@ -57,7 +55,7 @@ public function setUp(): void /** * @test */ - public function getRecordsInitiallyReturnsEmptyArray() :void + public function getRecordsInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -75,4 +73,4 @@ public function getImporterInitiallyReturnsOriginalObject(): void $this->subject->getImporter() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/DatamapPostprocessEventTest.php b/Tests/Unit/Event/DatamapPostprocessEventTest.php index bc9f8997..501036ca 100644 --- a/Tests/Unit/Event/DatamapPostprocessEventTest.php +++ b/Tests/Unit/Event/DatamapPostprocessEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the InsertRecordPreprocessEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class DatamapPostprocessEventTest extends UnitTestCase { @@ -57,7 +55,7 @@ public function setUp(): void /** * @test */ - public function getDataInitiallyReturnsEmptyArray() :void + public function getDataInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -75,4 +73,4 @@ public function getImporterInitiallyReturnsOriginalObject(): void $this->subject->getImporter() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/DeleteRecordPreprocessEventTest.php b/Tests/Unit/Event/DeleteRecordPreprocessEventTest.php index 54469499..78feb1db 100644 --- a/Tests/Unit/Event/DeleteRecordPreprocessEventTest.php +++ b/Tests/Unit/Event/DeleteRecordPreprocessEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the InsertRecordPreprocessEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class DeleteRecordPreprocessEventTest extends UnitTestCase { @@ -57,7 +55,7 @@ public function setUp(): void /** * @test */ - public function getRecordsInitiallyReturnsEmptyArray() :void + public function getRecordsInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -88,4 +86,4 @@ public function getImporterInitiallyReturnsOriginalObject(): void $this->subject->getImporter() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/InsertRecordPreprocessEventTest.php b/Tests/Unit/Event/InsertRecordPreprocessEventTest.php index c4d65c78..a0943132 100644 --- a/Tests/Unit/Event/InsertRecordPreprocessEventTest.php +++ b/Tests/Unit/Event/InsertRecordPreprocessEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the InsertRecordPreprocessEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class InsertRecordPreprocessEventTest extends UnitTestCase { @@ -57,7 +55,7 @@ public function setUp(): void /** * @test */ - public function getRecordInitiallyReturnsEmptyArray() :void + public function getRecordInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -88,4 +86,4 @@ public function getImporterInitiallyReturnsOriginalObject(): void $this->subject->getImporter() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/ProcessConnectorParametersEventTest.php b/Tests/Unit/Event/ProcessConnectorParametersEventTest.php index 8d5f4c94..1241b5d9 100644 --- a/Tests/Unit/Event/ProcessConnectorParametersEventTest.php +++ b/Tests/Unit/Event/ProcessConnectorParametersEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the ProcessConnectorParametersEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class ProcessConnectorParametersEventTest extends UnitTestCase { @@ -51,7 +49,7 @@ public function setUp(): void /** * @test */ - public function getParametersInitiallyReturnsEmptyArray() :void + public function getParametersInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -82,4 +80,4 @@ public function getExternalConfigurationInitiallyReturnsOriginalConfiguration(): $this->subject->getExternalConfiguration() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Event/UpdateRecordPreprocessEventTest.php b/Tests/Unit/Event/UpdateRecordPreprocessEventTest.php index 8568fdd5..9b941783 100644 --- a/Tests/Unit/Event/UpdateRecordPreprocessEventTest.php +++ b/Tests/Unit/Event/UpdateRecordPreprocessEventTest.php @@ -23,8 +23,6 @@ /** * Test suite for the UpdateRecordPreprocessEvent class - * - * @package Cobweb\ExternalImport\Tests\Unit\Event */ class UpdateRecordPreprocessEventTest extends UnitTestCase { @@ -58,7 +56,7 @@ public function setUp(): void /** * @test */ - public function getUidInitiallyReturnsInteger() :void + public function getUidInitiallyReturnsInteger(): void { self::assertSame( 42, @@ -69,7 +67,7 @@ public function getUidInitiallyReturnsInteger() :void /** * @test */ - public function getRecordInitiallyReturnsEmptyArray() :void + public function getRecordInitiallyReturnsEmptyArray(): void { self::assertSame( [], @@ -100,4 +98,4 @@ public function getImporterInitiallyReturnsOriginalObject(): void $this->subject->getImporter() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Handler/ArrayHandlerTest.php b/Tests/Unit/Handler/ArrayHandlerTest.php index 3d9e4371..b886b710 100644 --- a/Tests/Unit/Handler/ArrayHandlerTest.php +++ b/Tests/Unit/Handler/ArrayHandlerTest.php @@ -25,8 +25,6 @@ /** * Test suite for the ArrayHandler class. - * - * @package Cobweb\ExternalImport\Tests\Unit\Handler */ class ArrayHandlerTest extends UnitTestCase { @@ -52,23 +50,23 @@ public function getValueSuccessProvider(): array 'status' => 'valid', 'list' => [ 0 => 'me', - 1 => 'you' - ] + 1 => 'you', + ], ], 1 => [ 'status' => 'invalid', 'list' => [ - 4 => 'we' - ] + 4 => 'we', + ], ], 2 => [ 'status' => 'valid', 'list' => [ - 3 => 'them' - ] - ] - ] - ] + 3 => 'them', + ], + ], + ], + ], ]; $sampleStructureComplexity1Modified = $sampleStructureComplexity1; $sampleStructureComplexity1Modified['test']['data'][0]['status'] = 'invalid'; @@ -80,117 +78,117 @@ public function getValueSuccessProvider(): array 'list' => [ 0 => [ 'name' => 'me', - 'real' => true + 'real' => true, ], 1 => [ 'name' => 'you', - 'real' => false - ] - ] + 'real' => false, + ], + ], ], [ 'status' => 'invalid', 'list' => [ 4 => [ 'name' => 'we', - 'real' => true - ] - ] + 'real' => true, + ], + ], ], [ 'status' => 'valid', 'list' => [ 3 => [ 'name' => 'them', - 'real' => true - ] - ] - ] - ] - ] + 'real' => true, + ], + ], + ], + ], + ], ]; return [ 'fixed value - number zero' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'value' => 0 + 'value' => 0, ], - 'result' => 0 + 'result' => 0, ], 'fixed value - number non-zero' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'value' => 12 + 'value' => 12, ], - 'result' => 12 + 'result' => 12, ], 'fixed value - string empty' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'value' => '' + 'value' => '', ], - 'result' => '' + 'result' => '', ], 'fixed value - string not empty' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'value' => 'hey' + 'value' => 'hey', ], - 'result' => 'hey' + 'result' => 'hey', ], 'direct simple value' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'field' => 'foo' + 'field' => 'foo', ], - 'result' => 'bar' + 'result' => 'bar', ], 'direct simple value - null' => [ 'record' => [ - 'foo' => null + 'foo' => null, ], 'configuration' => [ - 'field' => 'foo' + 'field' => 'foo', ], - 'result' => null + 'result' => null, ], 'direct array value' => [ 'record' => [ 'test' => [ 'foo' => 'me', - 'bar' => 'you' - ] + 'bar' => 'you', + ], ], 'configuration' => [ - 'field' => 'test' + 'field' => 'test', ], 'result' => [ 'foo' => 'me', - 'bar' => 'you' - ] + 'bar' => 'you', + ], ], 'simple array path with keys, simple value' => [ 'record' => [ 'test' => [ 'foo' => 'me', - 'bar' => 'you' - ] + 'bar' => 'you', + ], ], 'configuration' => [ - 'arrayPath' => 'test/foo' + 'arrayPath' => 'test/foo', ], - 'result' => 'me' + 'result' => 'me', ], 'simple array path with keys, array value' => [ 'record' => [ @@ -198,30 +196,30 @@ public function getValueSuccessProvider(): array 'data' => [ 'list' => [ 0 => 'me', - 1 => 'you' - ] - ] - ] + 1 => 'you', + ], + ], + ], ], 'configuration' => [ - 'arrayPath' => 'test/data/list' + 'arrayPath' => 'test/data/list', ], 'result' => [ 0 => 'me', - 1 => 'you' - ] + 1 => 'you', + ], ], 'simple array path with indices' => [ 'record' => [ 'test' => [ 0 => 'me', - 1 => 'you' - ] + 1 => 'you', + ], ], 'configuration' => [ - 'arrayPath' => 'test/0' + 'arrayPath' => 'test/0', ], - 'result' => 'me' + 'result' => 'me', ], 'array path with condition on intermediary segment' => [ 'record' => [ @@ -230,108 +228,108 @@ public function getValueSuccessProvider(): array 'status' => 'valid', 'list' => [ 0 => 'me', - 1 => 'you' - ] - ] - ] + 1 => 'you', + ], + ], + ], ], 'configuration' => [ - 'arrayPath' => 'test/data{status === \'valid\'}/list' + 'arrayPath' => 'test/data{status === \'valid\'}/list', ], 'result' => [ 0 => 'me', - 1 => 'you' - ] + 1 => 'you', + ], ], 'array path with condition on final segment' => [ 'record' => [ 'test' => [ - 'data' => 'me' - ] + 'data' => 'me', + ], ], 'configuration' => [ - 'arrayPath' => 'test/data{value === \'me\'}' + 'arrayPath' => 'test/data{value === \'me\'}', ], 'result' => 'me', ], 'array path with children condition, multiple results' => [ 'record' => $sampleStructureComplexity1, 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/list' + 'arrayPath' => 'test/data/*{status === \'valid\'}/list', ], 'result' => [ 0 => 'me', 1 => 'you', - 2 => 'them' - ] + 2 => 'them', + ], ], 'array path with children condition, multiple results, matching structure preserved' => [ 'record' => $sampleStructureComplexity1, 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/./list' + 'arrayPath' => 'test/data/*{status === \'valid\'}/./list', ], 'result' => [ 0 => [ 0 => 'me', - 1 => 'you' + 1 => 'you', ], 1 => [ - 3 => 'them' - ] - ] + 3 => 'them', + ], + ], ], 'array path with multiple children condition, multiple results, matching structure preserved on every level' => [ 'record' => $sampleStructureComplexity2, 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/./list/*{real}/.' + 'arrayPath' => 'test/data/*{status === \'valid\'}/./list/*{real}/.', ], 'result' => [ 0 => [ 0 => [ 'name' => 'me', - 'real' => true - ] + 'real' => true, + ], ], 1 => [ 0 => [ 'name' => 'them', - 'real' => true - ] - ] - ] + 'real' => true, + ], + ], + ], ], 'array path with multiple children condition, multiple results, matching structure preserved on last level' => [ 'record' => $sampleStructureComplexity2, 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/list/*{real}/.' + 'arrayPath' => 'test/data/*{status === \'valid\'}/list/*{real}/.', ], 'result' => [ 0 => [ 'name' => 'me', - 'real' => true + 'real' => true, ], 1 => [ 'name' => 'them', - 'real' => true - ] - ] + 'real' => true, + ], + ], ], 'array path with children condition, single result' => [ 'record' => $sampleStructureComplexity1Modified, 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/list' + 'arrayPath' => 'test/data/*{status === \'valid\'}/list', ], 'result' => [ - 0 => 'them' - ] + 0 => 'them', + ], ], 'array path with children condition, single result, flattened' => [ 'record' => $sampleStructureComplexity1Modified, 'configuration' => [ 'arrayPath' => 'test/data/*{status === \'valid\'}/list', - 'arrayPathFlatten' => true + 'arrayPathFlatten' => true, ], - 'result' => 'them' + 'result' => 'them', ], 'array path with children condition, multiple results, sub-arrays' => [ 'record' => [ @@ -341,44 +339,44 @@ public function getValueSuccessProvider(): array 'status' => 'valid', 'list' => [ 0 => [ - 'name' => 'me' + 'name' => 'me', ], 1 => [ - 'name' => 'you' - ] - ] + 'name' => 'you', + ], + ], ], [ 'status' => 'invalid', 'list' => [ 4 => [ - 'name' => 'we' - ] - ] + 'name' => 'we', + ], + ], ], [ 'status' => 'valid', 'list' => [ 3 => [ - 'name' => 'them' - ] - ] + 'name' => 'them', + ], + ], ], - ] - ] + ], + ], ], 'configuration' => [ - 'arrayPath' => 'test/data/*{status === \'valid\'}/list' + 'arrayPath' => 'test/data/*{status === \'valid\'}/list', ], 'result' => [ 0 => [ - 'name' => 'me' + 'name' => 'me', ], 1 => [ - 'name' => 'you' + 'name' => 'you', ], 2 => [ - 'name' => 'them' + 'name' => 'them', ], ], ], @@ -402,7 +400,7 @@ public function getValueSuccessProvider(): array ], ], 'configuration' => [ - 'arrayPath' => 'test/data/*/name' + 'arrayPath' => 'test/data/*/name', ], 'result' => [ 0 => 'me', @@ -427,7 +425,7 @@ public function getValueSuccessProvider(): array ], ], 'configuration' => [ - 'arrayPath' => 'test/data/*' + 'arrayPath' => 'test/data/*', ], 'result' => [ 0 => 'me', @@ -452,7 +450,7 @@ public function getValueSuccessProvider(): array ], ], 'configuration' => [ - 'arrayPath' => 'test/data/*/.' + 'arrayPath' => 'test/data/*/.', ], 'result' => [ 0 => [ @@ -472,7 +470,7 @@ public function getValueSuccessProvider(): array 'data' => [ 0 => [ 'person' => [ - 'name' => 'me' + 'name' => 'me', ], 'thing' => [ 'name' => 'wheel', @@ -480,7 +478,7 @@ public function getValueSuccessProvider(): array ], 1 => [ 'person' => [ - 'name' => 'you' + 'name' => 'you', ], 'thing' => [ 'name' => 'brake', @@ -488,7 +486,7 @@ public function getValueSuccessProvider(): array ], 2 => [ 'person' => [ - 'name' => 'them' + 'name' => 'them', ], 'thing' => [ 'name' => 'bumper', @@ -502,13 +500,13 @@ public function getValueSuccessProvider(): array ], 'result' => [ 0 => [ - 'name' => 'me' + 'name' => 'me', ], 1 => [ - 'name' => 'you' + 'name' => 'you', ], 2 => [ - 'name' => 'them' + 'name' => 'them', ], ], ], @@ -536,37 +534,37 @@ public function getValueFailsWithInvalidArgumentExceptionProvider(): array return [ 'direct simple value' => [ 'record' => [ - 'foo' => 'bar' + 'foo' => 'bar', ], 'configuration' => [ - 'field' => 'baz' - ] + 'field' => 'baz', + ], ], 'wrong array path value' => [ 'record' => [ 'test' => [ 'test' => [ 'foo' => 'me', - 'bar' => 'you' - ] - ] + 'bar' => 'you', + ], + ], ], 'configuration' => [ - 'arrayPath' => false - ] + 'arrayPath' => false, + ], ], 'non-matching array path value (array type)' => [ 'record' => [ 'test' => [ 'test' => [ 'foo' => 'me', - 'bar' => 'you' - ] - ] + 'bar' => 'you', + ], + ], ], 'configuration' => [ - 'arrayPath' => 'foo/baz' - ] + 'arrayPath' => 'foo/baz', + ], ], 'non-matching array path value (array type, children condition)' => [ 'record' => [ @@ -578,37 +576,37 @@ public function getValueFailsWithInvalidArgumentExceptionProvider(): array ], [ 'status' => 'ko', - 'foo' => 'you' - ] - ] - ] + 'foo' => 'you', + ], + ], + ], ], 'configuration' => [ - 'arrayPath' => 'data/tests/*{status === \'ok\'}' - ] + 'arrayPath' => 'data/tests/*{status === \'ok\'}', + ], ], 'non-matching array path value (simple type)' => [ 'record' => [ 'test' => [ - 'data' => 'me' - ] + 'data' => 'me', + ], ], 'configuration' => [ - 'arrayPath' => 'test/data{value === \'you\'}' - ] + 'arrayPath' => 'test/data{value === \'you\'}', + ], ], 'array path value with invalid condition' => [ 'record' => [ 'test' => [ 'test' => [ 'foo' => 'me', - 'bar' => 'you' - ] - ] + 'bar' => 'you', + ], + ], ], 'configuration' => [ - 'arrayPath' => 'foo/baz{foo === \'bar\'}' - ] + 'arrayPath' => 'foo/baz{foo === \'bar\'}', + ], ], ]; } @@ -633,40 +631,40 @@ public function getSubstructureProvider(): array [ 'foo' => 'me', 'bar' => [ - 'who' => 'you' + 'who' => 'you', ], - 'baz' => 'them' + 'baz' => 'them', ], [ 'foo' => 'me2', 'bar' => [ - 'who' => 'you2' + 'who' => 'you2', ], - 'baz' => 'them2' - ] + 'baz' => 'them2', + ], ], 'configuration' => [ 'first' => [ - 'field' => 'foo' + 'field' => 'foo', ], 'second' => [ - 'arrayPath' => 'bar/who' + 'arrayPath' => 'bar/who', ], 'third' => [ - 'field' => 'unknown' - ] + 'field' => 'unknown', + ], ], 'result' => [ [ 'first' => 'me', - 'second' => 'you' + 'second' => 'you', ], [ 'first' => 'me2', - 'second' => 'you2' - ] - ] - ] + 'second' => 'you2', + ], + ], + ], ]; } @@ -691,161 +689,161 @@ public function rawDataProvider(): array 'empty raw data' => [ 'generalConfiguration' => [], 'rawData' => [], - 'expectedStructure' => [] + 'expectedStructure' => [], ], 'raw data with non matching fields' => [ 'generalConfiguration' => [], 'rawData' => [ [ - 'crazy_field' => 2 + 'crazy_field' => 2, ], [ - 'crazy_field' => 1 - ] + 'crazy_field' => 1, + ], ], - 'expectedStructure' => [] + 'expectedStructure' => [], ], 'raw data with no additional field' => [ 'generalConfiguration' => [], 'rawData' => [ [ - 'normal_field' => 2 + 'normal_field' => 2, ], [ - 'normal_field' => 1 + 'normal_field' => 1, ], [ - 'crazy_field' => 42 - ] + 'crazy_field' => 42, + ], ], 'expectedStructure' => [ [ - 'name' => 2 + 'name' => 2, ], [ - 'name' => 1 - ] - ] + 'name' => 1, + ], + ], ], 'raw data with column array path' => [ 'generalConfiguration' => [], 'rawData' => [ [ 'brand' => [ - 'name' => 'foo' - ] + 'name' => 'foo', + ], ], [ 'brand' => [ - 'name' => 'bar' - ] + 'name' => 'bar', + ], ], [ - 'crazy_field' => 42 - ] + 'crazy_field' => 42, + ], ], 'expectedStructure' => [ [ - 'brand' => 'foo' + 'brand' => 'foo', ], [ - 'brand' => 'bar' - ] - ] + 'brand' => 'bar', + ], + ], ], 'raw data with additional field' => [ 'generalConfiguration' => [], 'rawData' => [ [ 'normal_field' => 2, - 'special_field' => 'foo' + 'special_field' => 'foo', ], [ 'normal_field' => 1, - 'special_field' => 'bar' - ] + 'special_field' => 'bar', + ], ], 'expectedStructure' => [ [ 'name' => 2, - 'special' => 'foo' + 'special' => 'foo', ], [ 'name' => 1, - 'special' => 'bar' - ] - ] + 'special' => 'bar', + ], + ], ], 'raw data with general array path' => [ 'generalConfiguration' => [ - 'arrayPath' => 'data/items' + 'arrayPath' => 'data/items', ], 'rawData' => [ 'data' => [ 'items' => [ [ - 'normal_field' => 2 + 'normal_field' => 2, ], [ - 'normal_field' => 1 + 'normal_field' => 1, ], [ - 'crazy_field' => 42 - ] - ] - ] + 'crazy_field' => 42, + ], + ], + ], ], 'expectedStructure' => [ [ - 'name' => 2 + 'name' => 2, ], [ - 'name' => 1 - ] - ] + 'name' => 1, + ], + ], ], 'raw data with general invalid array path (empty)' => [ 'generalConfiguration' => [ - 'arrayPath' => '' + 'arrayPath' => '', ], 'rawData' => [ 'data' => [ 'items' => [ [ - 'normal_field' => 2 + 'normal_field' => 2, ], [ - 'normal_field' => 1 + 'normal_field' => 1, ], [ - 'crazy_field' => 42 - ] - ] - ] + 'crazy_field' => 42, + ], + ], + ], ], - 'expectedStructure' => [] + 'expectedStructure' => [], ], 'raw data with general non-matching array path' => [ 'generalConfiguration' => [ - 'arrayPath' => 'foo/bar' + 'arrayPath' => 'foo/bar', ], 'rawData' => [ 'data' => [ 'items' => [ [ - 'normal_field' => 2 + 'normal_field' => 2, ], [ - 'normal_field' => 1 + 'normal_field' => 1, ], [ - 'crazy_field' => 42 - ] - ] - ] + 'crazy_field' => 42, + ], + ], + ], ], - 'expectedStructure' => [] - ] + 'expectedStructure' => [], + ], ]; } @@ -863,16 +861,16 @@ public function handleDataReturnsStructureData(array $generalConfiguration, arra ->willReturn( [ 'name' => [ - 'field' => 'normal_field' + 'field' => 'normal_field', ], 'brand' => [ 'arrayPath' => 'brand|name', - 'arrayPathSeparator' => '|' + 'arrayPathSeparator' => '|', ], 'special' => [ 'field' => 'special_field', - Configuration::DO_NOT_SAVE_KEY => true - ] + Configuration::DO_NOT_SAVE_KEY => true, + ], ] ); $configuration->method('getGeneralConfiguration') @@ -887,4 +885,4 @@ public function handleDataReturnsStructureData(array $generalConfiguration, arra $structuredData ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Handler/XmlHandlerTest.php b/Tests/Unit/Handler/XmlHandlerTest.php index b0dca09e..9405b0c8 100644 --- a/Tests/Unit/Handler/XmlHandlerTest.php +++ b/Tests/Unit/Handler/XmlHandlerTest.php @@ -23,8 +23,6 @@ /** * Test suite for the XmlHandler class. - * - * @package Cobweb\ExternalImport\Tests\Unit\Handler */ class XmlHandlerTest extends UnitTestCase { @@ -47,60 +45,60 @@ public function getValueSuccessProvider(): array 'fixed value - number zero' => [ 'structure' => 'foo', 'configuration' => [ - 'value' => 0 + 'value' => 0, ], - 'result' => 0 + 'result' => 0, ], 'fixed value - number non-zero' => [ 'structure' => 'foo', 'configuration' => [ - 'value' => 12 + 'value' => 12, ], - 'result' => 12 + 'result' => 12, ], 'fixed value - string empty' => [ 'structure' => 'foo', 'configuration' => [ - 'value' => '' + 'value' => '', ], - 'result' => '' + 'result' => '', ], 'fixed value - string not empty' => [ 'structure' => 'foo', 'configuration' => [ - 'value' => 'hey' + 'value' => 'hey', ], - 'result' => 'hey' + 'result' => 'hey', ], 'direct simple value' => [ 'structure' => 'foo', 'configuration' => [ - 'field' => 'item' + 'field' => 'item', ], - 'result' => 'foo' + 'result' => 'foo', ], 'xpath value' => [ 'structure' => 'foo', 'configuration' => [ - 'xpath' => 'item/bar' + 'xpath' => 'item/bar', ], - 'result' => 'foo' + 'result' => 'foo', ], 'substructure as string' => [ 'structure' => 'meyou', 'configuration' => [ - 'field' => 'item' + 'field' => 'item', ], - 'result' => 'meyou' + 'result' => 'meyou', ], 'substructure as xml' => [ 'structure' => 'meyou', 'configuration' => [ 'field' => 'item', - 'xmlValue' => true + 'xmlValue' => true, ], - 'result' => 'meyou' - ] + 'result' => 'meyou', + ], ]; } @@ -134,26 +132,26 @@ public function getSubstructureProvider(): array 'structure' => 'meyouthemme2you2them2', 'configuration' => [ 'first' => [ - 'field' => 'foo' + 'field' => 'foo', ], 'second' => [ - 'xpath' => 'bar/who' + 'xpath' => 'bar/who', ], 'third' => [ - 'field' => 'unknown' - ] + 'field' => 'unknown', + ], ], 'result' => [ [ 'first' => 'me', - 'second' => 'you' + 'second' => 'you', ], [ 'first' => 'me2', - 'second' => 'you2' - ] - ] - ] + 'second' => 'you2', + ], + ], + ], ]; } @@ -178,4 +176,4 @@ public function getSubstructureValuesReturnsExpectedRows(string $structure, arra $this->subject->getSubstructureValues($nodeList, $configuration, $xPathObject) ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/ImporterTest.php b/Tests/Unit/ImporterTest.php index 4084a121..722ee2d9 100644 --- a/Tests/Unit/ImporterTest.php +++ b/Tests/Unit/ImporterTest.php @@ -27,12 +27,9 @@ /** * Test case for the External Import importer. - * - * @package Cobweb\ExternalImport\Tests\Unit */ class ImporterTest extends UnitTestCase { - /** * @var Importer */ @@ -96,7 +93,7 @@ public function getMessagesInitiallyReturnsEmptyStructure(): void [ AbstractMessage::ERROR => [], AbstractMessage::WARNING => [], - AbstractMessage::OK => [] + AbstractMessage::OK => [], ], $this->subject->getMessages() ); @@ -125,7 +122,7 @@ public function resetMessagesInitiallyPreparesEmptyStructure(): void [ AbstractMessage::ERROR => [], AbstractMessage::WARNING => [], - AbstractMessage::OK => [] + AbstractMessage::OK => [], ], $this->subject->getMessages() ); @@ -252,14 +249,14 @@ public function previewDataProvider(): array { return [ 'string' => [ - 'foo' + 'foo', ], 'array' => [ [ 'name' => 'Foo', - 'title' => 'Bar' - ] - ] + 'title' => 'Bar', + ], + ], ]; } @@ -335,4 +332,4 @@ public function setEndTimeSetsEndTime(): void $this->subject->getEndTime() ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Step/CheckPermissionsStepTest.php b/Tests/Unit/Step/CheckPermissionsStepTest.php index 45df9170..11ab3475 100644 --- a/Tests/Unit/Step/CheckPermissionsStepTest.php +++ b/Tests/Unit/Step/CheckPermissionsStepTest.php @@ -23,8 +23,6 @@ /** * Unit test suite for the Check Permissions Data step class. Actually this is mostly for testing * the base methods from the AbstractStep class. - * - * @package Cobweb\ExternalImport\Tests\Unit\Step */ class CheckPermissionsStepTest extends UnitTestCase { @@ -45,7 +43,7 @@ public function setUp(): void public function getDataInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getData() + $this->subject->getData() ); } @@ -57,8 +55,8 @@ public function setDataSetsDataObject(): void $data = new Data(); $this->subject->setData($data); self::assertSame( - $data, - $this->subject->getData() + $data, + $this->subject->getData() ); } @@ -68,7 +66,7 @@ public function setDataSetsDataObject(): void public function isAbortFlagInitiallyReturnsFalse(): void { self::assertFalse( - $this->subject->isAbortFlag() + $this->subject->isAbortFlag() ); } @@ -79,7 +77,7 @@ public function setAbortFlagSetsBooleanFlag(): void { $this->subject->setAbortFlag(true); self::assertTrue( - $this->subject->isAbortFlag() + $this->subject->isAbortFlag() ); } @@ -89,8 +87,8 @@ public function setAbortFlagSetsBooleanFlag(): void public function getParametersInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getParameters() + [], + $this->subject->getParameters() ); } @@ -100,11 +98,11 @@ public function getParametersInitiallyReturnsEmptyArray(): void public function setParametersSetsArray(): void { $this->subject->setParameters( - ['foo' => 'bar'] + ['foo' => 'bar'] ); self::assertSame( - ['foo' => 'bar'], - $this->subject->getParameters() + ['foo' => 'bar'], + $this->subject->getParameters() ); } @@ -114,17 +112,17 @@ public function parametersProvider(): array 'initially returns null - no matter what key' => [ 'parameters' => null, 'key' => 'foo', - 'expected' => null + 'expected' => null, ], 'returns expected value with valid key' => [ 'parameters' => ['foo' => 'bar'], 'key' => 'foo', - 'expected' => 'bar' + 'expected' => 'bar', ], 'returns null with invalid key' => [ 'parameters' => ['foo' => 'bar'], 'key' => 'baz', - 'expected' => null + 'expected' => null, ], ]; } @@ -142,8 +140,8 @@ public function getParameterReturnsExpectedValueForKey($parameters, $key, $expec $this->subject->setParameters($parameters); } self::assertSame( - $expected, - $this->subject->getParameter($key) + $expected, + $this->subject->getParameter($key) ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Step/StoreDataStepTest.php b/Tests/Unit/Step/StoreDataStepTest.php index fdf88dcd..1e745eb6 100644 --- a/Tests/Unit/Step/StoreDataStepTest.php +++ b/Tests/Unit/Step/StoreDataStepTest.php @@ -23,8 +23,6 @@ /** * Unit test suite for the Store Data step class. - * - * @package Cobweb\ExternalImport\Tests\Unit\Step */ class StoreDataStepTest extends UnitTestCase { @@ -62,21 +60,21 @@ public function sortPagesProvider(): array [ 34 => [ 'title' => 'Foo', - 'pid' => 23 + 'pid' => 23, ], 42 => [ 'title' => 'Bar', - 'pid' => 34 + 'pid' => 34, ], ], [ 34 => [ 'title' => 'Foo', - 'pid' => 23 + 'pid' => 23, ], 42 => [ 'title' => 'Bar', - 'pid' => 34 + 'pid' => 34, ], ], ], @@ -84,116 +82,116 @@ public function sortPagesProvider(): array [ 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 4 + 'pid' => 4, ], 'NEW2' => [ 'title' => 'Parent 2', - 'pid' => 4 + 'pid' => 4, ], 'NEW3' => [ 'title' => 'Parent 3', - 'pid' => 10 + 'pid' => 10, ], ], [ 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 4 + 'pid' => 4, ], 'NEW2' => [ 'title' => 'Parent 2', - 'pid' => 4 + 'pid' => 4, ], 'NEW3' => [ 'title' => 'Parent 3', - 'pid' => 10 + 'pid' => 10, ], - ] + ], ], 'New pages, nested' => [ [ 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 0 + 'pid' => 0, ], 'NEW2' => [ 'title' => 'Child 1.1', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW3' => [ 'title' => 'Child 1.2', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW4' => [ 'title' => 'Parent 2', - 'pid' => 0 + 'pid' => 0, ], 'NEW5' => [ 'title' => 'Child 2.1', - 'pid' => 'NEW4' + 'pid' => 'NEW4', ], 'NEW6' => [ 'title' => 'Child 2.1.1', - 'pid' => 'NEW5' + 'pid' => 'NEW5', ], 'NEW7' => [ 'title' => 'Child 2.2', - 'pid' => 'NEW4' + 'pid' => 'NEW4', ], ], [ 'NEW6' => [ 'title' => 'Child 2.1.1', - 'pid' => 'NEW5' + 'pid' => 'NEW5', ], 'NEW2' => [ 'title' => 'Child 1.1', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW3' => [ 'title' => 'Child 1.2', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW5' => [ 'title' => 'Child 2.1', - 'pid' => 'NEW4' + 'pid' => 'NEW4', ], 'NEW7' => [ 'title' => 'Child 2.2', - 'pid' => 'NEW4' + 'pid' => 'NEW4', ], 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 0 + 'pid' => 0, ], 'NEW4' => [ 'title' => 'Parent 2', - 'pid' => 0 + 'pid' => 0, ], - ] + ], ], 'Page updated to new parent' => [ [ 24 => [ 'title' => 'Existing page', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 0 - ] + 'pid' => 0, + ], ], [ 24 => [ 'title' => 'Existing page', - 'pid' => 'NEW1' + 'pid' => 'NEW1', ], 'NEW1' => [ 'title' => 'Parent 1', - 'pid' => 0 - ] - ] - ] + 'pid' => 0, + ], + ], + ], ]; } @@ -207,8 +205,8 @@ public function sortPagesDataSortsParentAndChildren(array $input, array $expecte { $sortedData = $this->subject->sortPagesData($input); self::assertSame( - $sortedData, - $expected + $sortedData, + $expected ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Utility/CsvUtilityTest.php b/Tests/Unit/Utility/CsvUtilityTest.php index 14883486..b6477658 100644 --- a/Tests/Unit/Utility/CsvUtilityTest.php +++ b/Tests/Unit/Utility/CsvUtilityTest.php @@ -121,4 +121,4 @@ public function ensureCompleteStructureCompletesStructureAsNeeded(array $input, $result = $this->subject->ensureCompleteStructure($input); self::assertSame($output, $result); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Utility/MappingUtilityTest.php b/Tests/Unit/Utility/MappingUtilityTest.php index 51fef920..98b73584 100644 --- a/Tests/Unit/Utility/MappingUtilityTest.php +++ b/Tests/Unit/Utility/MappingUtilityTest.php @@ -21,8 +21,6 @@ /** * Test case for the External Import mapping utility. - * - * @package Cobweb\ExternalImport\Tests\Unit\Utility */ class MappingUtilityTest extends UnitTestCase { @@ -51,14 +49,14 @@ public function mappingTestWithStrposProvider(): array 'inputData' => 'Australia', 'mappingTable' => [ 'Commonwealth of Australia' => 'AU', - 'Kingdom of Spain' => 'ES' + 'Kingdom of Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'strpos', - 'matchSymmetric' => false + 'matchSymmetric' => false, ], - 'result' => 'AU' - ] + 'result' => 'AU', + ], ]; } @@ -91,14 +89,14 @@ public function mappingTestWithStrposSymmetricProvider(): array 'inputData' => 'Commonwealth of Australia', 'mappingTable' => [ 'Australia' => 'AU', - 'Spain' => 'ES' + 'Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'strpos', - 'matchSymmetric' => true + 'matchSymmetric' => true, ], - 'result' => 'AU' - ] + 'result' => 'AU', + ], ]; } @@ -131,24 +129,24 @@ public function mappingTestWithStrposWithBadMappingTableProvider(): array 'inputData' => 'australia', 'mappingTable' => [ 'Commonwealth of Australia' => 'AU', - 'Kingdom of Spain' => 'ES' + 'Kingdom of Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'strpos', - 'matchSymmetric' => false - ] + 'matchSymmetric' => false, + ], ], 'no matching data' => [ 'inputData' => 'Swaziland', 'mappingTable' => [ 'Commonwealth of Australia' => 'AU', - 'Kingdom of Spain' => 'ES' + 'Kingdom of Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'strpos', - 'matchSymmetric' => false - ] - ] + 'matchSymmetric' => false, + ], + ], ]; } @@ -177,14 +175,14 @@ public function mappingTestWithStriposProvider(): array 'inputData' => 'australia', 'mappingTable' => [ 'Commonwealth of Australia' => 'AU', - 'Kingdom of Spain' => 'ES' + 'Kingdom of Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'stripos', - 'matchSymmetric' => false + 'matchSymmetric' => false, ], - 'result' => 'AU' - ] + 'result' => 'AU', + ], ]; return $data; } @@ -219,13 +217,13 @@ public function mappingTestWithStriposWithBadMappingTableProvider(): array 'inputData' => 'Swaziland', 'mappingTable' => [ 'Commonwealth of Australia' => 'AU', - 'Kingdom of Spain' => 'ES' + 'Kingdom of Spain' => 'ES', ], 'mappingConfiguration' => [ 'matchMethod' => 'strpos', - 'matchSymmetric' => false - ] - ] + 'matchSymmetric' => false, + ], + ], ]; } diff --git a/Tests/Unit/Utility/ReportingUtilityTest.php b/Tests/Unit/Utility/ReportingUtilityTest.php index 62c1154a..d5fd5cd6 100644 --- a/Tests/Unit/Utility/ReportingUtilityTest.php +++ b/Tests/Unit/Utility/ReportingUtilityTest.php @@ -27,8 +27,6 @@ /** * Test suite for simple methods from the reporting utility. - * - * @package Cobweb\ExternalImport\Tests\Unit\Utility */ class ReportingUtilityTest extends UnitTestCase { @@ -93,4 +91,4 @@ public function getValueForStepReturnsExpectedValue(): void self::fail($e->getMessage()); } } -} \ No newline at end of file +} diff --git a/Tests/Unit/Utility/StepUtilityTest.php b/Tests/Unit/Utility/StepUtilityTest.php index b5154a00..afb15d19 100644 --- a/Tests/Unit/Utility/StepUtilityTest.php +++ b/Tests/Unit/Utility/StepUtilityTest.php @@ -18,15 +18,13 @@ */ use Cobweb\ExternalImport\Importer; +use Cobweb\ExternalImport\Step; use Cobweb\ExternalImport\Utility\StepUtility; use Nimut\TestingFramework\TestCase\UnitTestCase; use TYPO3\CMS\Core\Utility\GeneralUtility; -use Cobweb\ExternalImport\Step; /** * Test case for the Step utility. - * - * @package Cobweb\ExternalImport\Tests\Unit */ class StepUtilityTest extends UnitTestCase { @@ -53,7 +51,7 @@ public function customStepsGoodConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'before:' . Step\CheckPermissionsStep::class + 'position' => 'before:' . Step\CheckPermissionsStep::class, ], // Resulting steps [ @@ -69,7 +67,7 @@ public function customStepsGoodConfigurationProvider(): array Step\ClearCacheStep::class, Step\ConnectorCallbackStep::class, Step\ReportStep::class, - ] + ], ], 'insert step after transform data' => [ // Current steps @@ -77,7 +75,7 @@ public function customStepsGoodConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'after:' . Step\TransformDataStep::class + 'position' => 'after:' . Step\TransformDataStep::class, ], // Resulting steps [ @@ -93,13 +91,13 @@ public function customStepsGoodConfigurationProvider(): array Step\ClearCacheStep::class, Step\ConnectorCallbackStep::class, Step\ReportStep::class, - ] + ], ], 'insert step before validate data step' => [ Importer::IMPORT_DATA_STEPS, [ 'class' => Step\HandleDataStep::class, - 'position' => 'before:' . Step\ValidateDataStep::class + 'position' => 'before:' . Step\ValidateDataStep::class, ], [ Step\CheckPermissionsStep::class, @@ -111,7 +109,7 @@ public function customStepsGoodConfigurationProvider(): array Step\StoreDataStep::class, Step\ClearCacheStep::class, Step\ReportStep::class, - ] + ], ], 'insert step after last step' => [ // Current steps @@ -119,7 +117,7 @@ public function customStepsGoodConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'after:' . Step\ReportStep::class + 'position' => 'after:' . Step\ReportStep::class, ], // Resulting steps [ @@ -134,9 +132,9 @@ public function customStepsGoodConfigurationProvider(): array Step\ClearCacheStep::class, Step\ConnectorCallbackStep::class, Step\ReportStep::class, - Step\HandleDataStep::class - ] - ] + Step\HandleDataStep::class, + ], + ], ]; } @@ -172,16 +170,16 @@ public function customStepsWrongConfigurationProvider(): array Importer::SYNCHRONYZE_DATA_STEPS, // New step configuration [ - 'position' => 'after:' . Step\TransformDataStep::class - ] + 'position' => 'after:' . Step\TransformDataStep::class, + ], ], 'insert step with missing position information' => [ // Current steps Importer::SYNCHRONYZE_DATA_STEPS, // New step configuration [ - 'class' => Step\HandleDataStep::class - ] + 'class' => Step\HandleDataStep::class, + ], ], 'insert step with wrong syntax for position' => [ // Current steps @@ -189,8 +187,8 @@ public function customStepsWrongConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => Step\TransformDataStep::class - ] + 'position' => Step\TransformDataStep::class, + ], ], 'insert step with wrong keyword for position' => [ // Current steps @@ -198,8 +196,8 @@ public function customStepsWrongConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'next:' . Step\TransformDataStep::class - ] + 'position' => 'next:' . Step\TransformDataStep::class, + ], ], 'insert step with unknown class' => [ // Current steps @@ -207,8 +205,8 @@ public function customStepsWrongConfigurationProvider(): array // New step configuration [ 'class' => 'Foo\\Bar\\Baz', - 'position' => 'after:' . Step\TransformDataStep::class - ] + 'position' => 'after:' . Step\TransformDataStep::class, + ], ], 'insert step after unregistered step' => [ // Current steps @@ -216,8 +214,8 @@ public function customStepsWrongConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'after:' . Step\ReadDataStep::class - ] + 'position' => 'after:' . Step\ReadDataStep::class, + ], ], 'insert step after unknown step' => [ // Current steps @@ -225,8 +223,8 @@ public function customStepsWrongConfigurationProvider(): array // New step configuration [ 'class' => Step\HandleDataStep::class, - 'position' => 'before:Not\\Known\\Step' - ] + 'position' => 'before:Not\\Known\\Step', + ], ], // TODO: to be complete the instantiation of an improper class should be tested, but this would be a functional test ]; @@ -265,4 +263,4 @@ public function insertStepWithWrongInformationReturnsCurrentSteps(array $current ) ); } -} \ No newline at end of file +} diff --git a/Tests/Unit/Validator/ValidationResultTest.php b/Tests/Unit/Validator/ValidationResultTest.php index 32841144..26f54c1d 100644 --- a/Tests/Unit/Validator/ValidationResultTest.php +++ b/Tests/Unit/Validator/ValidationResultTest.php @@ -21,8 +21,6 @@ /** * Test case for the ValidationResult class. - * - * @package Cobweb\ExternalImport\Tests\Unit */ class ValidationResultTest extends UnitTestCase { @@ -43,8 +41,8 @@ public function setUp(): void public function getAllInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getAll() + [], + $this->subject->getAll() ); } @@ -56,8 +54,8 @@ public function resetSetsResultsToEmptyArray(): void $this->subject->add('foo', 'This is a validation result', AbstractMessage::NOTICE); $this->subject->reset(); self::assertSame( - [], - $this->subject->getAll() + [], + $this->subject->getAll() ); } @@ -67,7 +65,7 @@ public function resetSetsResultsToEmptyArray(): void public function getForPropertyInitiallyReturnsNull(): void { self::assertNull( - $this->subject->getForProperty('foo') + $this->subject->getForProperty('foo') ); } @@ -77,8 +75,8 @@ public function getForPropertyInitiallyReturnsNull(): void public function getForSeverityInitiallyReturnsEmptyArray(): void { self::assertSame( - [], - $this->subject->getForSeverity(AbstractMessage::NOTICE) + [], + $this->subject->getForSeverity(AbstractMessage::NOTICE) ); } @@ -95,134 +93,134 @@ public function getSampleMessages(): array [ 'property' => 'foo', 'message' => 'This is a validation result', - 'severity' => AbstractMessage::NOTICE - ] - ] + 'severity' => AbstractMessage::NOTICE, + ], + ], ], 'single message, not requested property, not requested severity' => [ 'messages' => [ [ 'property' => 'baz', 'message' => 'This is a baz validation result', - 'severity' => AbstractMessage::ERROR - ] - ] + 'severity' => AbstractMessage::ERROR, + ], + ], ], 'two messages, same property, same severity' => [ 'messages' => [ [ 'property' => 'foo', 'message' => 'This is a validation result', - 'severity' => AbstractMessage::NOTICE + 'severity' => AbstractMessage::NOTICE, ], [ 'property' => 'foo', 'message' => 'This is a second validation result', - 'severity' => AbstractMessage::NOTICE - ] - ] + 'severity' => AbstractMessage::NOTICE, + ], + ], ], 'two messages, same property, different severity' => [ 'messages' => [ [ 'property' => 'foo', 'message' => 'This is a notice validation result', - 'severity' => AbstractMessage::NOTICE + 'severity' => AbstractMessage::NOTICE, ], [ 'property' => 'foo', 'message' => 'This is a warning validation result', - 'severity' => AbstractMessage::WARNING - ] - ] + 'severity' => AbstractMessage::WARNING, + ], + ], ], 'two messages, different property, same severity' => [ 'messages' => [ [ 'property' => 'foo', 'message' => 'This is a foo validation result', - 'severity' => AbstractMessage::NOTICE + 'severity' => AbstractMessage::NOTICE, ], [ 'property' => 'bar', 'message' => 'This is a bar validation result', - 'severity' => AbstractMessage::NOTICE - ] - ] - ] + 'severity' => AbstractMessage::NOTICE, + ], + ], + ], ]; } public function allResultsProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'expected' => [ - 'foo' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a validation result' - ] - ] - ] - ], - 'single message, not requested property, not requested severity' => [ - 'expected' => [ - 'baz' => [ - [ - 'severity' => AbstractMessage::ERROR, - 'message' => 'This is a baz validation result' - ] - ] - ] - ], - 'two messages, same property, same severity' => [ - 'expected' => [ - 'foo' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a validation result' - ], - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a second validation result' - ] - ] - ] - ], - 'two messages, same property, different severity' => [ - 'expected' => [ - 'foo' => [ - [ - 'severity' => AbstractMessage::WARNING, - 'message' => 'This is a warning validation result' - ], - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a notice validation result' - ] - ] - ] - ], - 'two messages, different property, same severity' => [ - 'expected' => [ - 'foo' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a foo validation result' - ], - ], - 'bar' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a bar validation result' - ] - ] - ] - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'expected' => [ + 'foo' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a validation result', + ], + ], + ], + ], + 'single message, not requested property, not requested severity' => [ + 'expected' => [ + 'baz' => [ + [ + 'severity' => AbstractMessage::ERROR, + 'message' => 'This is a baz validation result', + ], + ], + ], + ], + 'two messages, same property, same severity' => [ + 'expected' => [ + 'foo' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a validation result', + ], + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a second validation result', + ], + ], + ], + ], + 'two messages, same property, different severity' => [ + 'expected' => [ + 'foo' => [ + [ + 'severity' => AbstractMessage::WARNING, + 'message' => 'This is a warning validation result', + ], + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a notice validation result', + ], + ], + ], + ], + 'two messages, different property, same severity' => [ + 'expected' => [ + 'foo' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a foo validation result', + ], + ], + 'bar' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a bar validation result', + ], + ], + ], + ], + ] ); } @@ -236,8 +234,8 @@ public function addAddsResultToList(array $messages, array $expectedStructure): { $this->loadMessages($messages); self::assertSame( - $expectedStructure, - $this->subject->getAll() + $expectedStructure, + $this->subject->getAll() ); } @@ -254,65 +252,65 @@ public function getAllReturnsAllMessages(array $messages, array $expectedStructu { $this->loadMessages($messages); self::assertSame( - $expectedStructure, - $this->subject->getAll() + $expectedStructure, + $this->subject->getAll() ); } public function forPropertyProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'property' => 'foo', - 'expected' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a validation result' - ] - ] - ], - 'single message, not requested property, not requested severity' => [ - 'property' => 'foo', - 'expected' => null - ], - 'two messages, same property, same severity' => [ - 'property' => 'foo', - 'expected' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a validation result' - ], - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a second validation result' - ] - ] - ], - 'two messages, same property, different severity' => [ - 'property' => 'foo', - 'expected' => [ - [ - 'severity' => AbstractMessage::WARNING, - 'message' => 'This is a warning validation result' - ], - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a notice validation result' - ] - ] - ], - 'two messages, different property, same severity' => [ - 'property' => 'foo', - 'expected' => [ - [ - 'severity' => AbstractMessage::NOTICE, - 'message' => 'This is a foo validation result' - ] - ] - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'property' => 'foo', + 'expected' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a validation result', + ], + ], + ], + 'single message, not requested property, not requested severity' => [ + 'property' => 'foo', + 'expected' => null, + ], + 'two messages, same property, same severity' => [ + 'property' => 'foo', + 'expected' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a validation result', + ], + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a second validation result', + ], + ], + ], + 'two messages, same property, different severity' => [ + 'property' => 'foo', + 'expected' => [ + [ + 'severity' => AbstractMessage::WARNING, + 'message' => 'This is a warning validation result', + ], + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a notice validation result', + ], + ], + ], + 'two messages, different property, same severity' => [ + 'property' => 'foo', + 'expected' => [ + [ + 'severity' => AbstractMessage::NOTICE, + 'message' => 'This is a foo validation result', + ], + ], + ], + ] ); } @@ -327,59 +325,59 @@ public function getForPropertyReturnsAllMessagesForProperty(array $messages, str { $this->loadMessages($messages); self::assertSame( - $expectedStructure, - $this->subject->getForProperty($property) + $expectedStructure, + $this->subject->getForProperty($property) ); } public function forSeverityProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => [ - 'foo' => [ - 'This is a validation result' - ] - ] - ], - 'single message, not requested property, not requested severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => [ - 'baz' => [] - ] - ], - 'two messages, same property, same severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => [ - 'foo' => [ - 'This is a validation result', - 'This is a second validation result' - ] - ] - ], - 'two messages, same property, different severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => [ - 'foo' => [ - 'This is a notice validation result' - ] - ] - ], - 'two messages, different property, same severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => [ - 'foo' => [ - 'This is a foo validation result' - ], - 'bar' => [ - 'This is a bar validation result' - ] - ] - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => [ + 'foo' => [ + 'This is a validation result', + ], + ], + ], + 'single message, not requested property, not requested severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => [ + 'baz' => [], + ], + ], + 'two messages, same property, same severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => [ + 'foo' => [ + 'This is a validation result', + 'This is a second validation result', + ], + ], + ], + 'two messages, same property, different severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => [ + 'foo' => [ + 'This is a notice validation result', + ], + ], + ], + 'two messages, different property, same severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => [ + 'foo' => [ + 'This is a foo validation result', + ], + 'bar' => [ + 'This is a bar validation result', + ], + ], + ], + ] ); } @@ -394,37 +392,37 @@ public function getForSeverityReturnsAllMessagesForSeverity(array $messages, int { $this->loadMessages($messages); self::assertSame( - $expectedStructure, - $this->subject->getForSeverity($severity) + $expectedStructure, + $this->subject->getForSeverity($severity) ); } public function countForPropertyProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'property' => 'foo', - 'expected' => 1 - ], - 'single message, not requested property, not requested severity' => [ - 'property' => 'foo', - 'expected' => 0 - ], - 'two messages, same property, same severity' => [ - 'property' => 'foo', - 'expected' => 2 - ], - 'two messages, same property, different severity' => [ - 'property' => 'foo', - 'expected' => 2 - ], - 'two messages, different property, same severity' => [ - 'property' => 'foo', - 'expected' => 1 - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'property' => 'foo', + 'expected' => 1, + ], + 'single message, not requested property, not requested severity' => [ + 'property' => 'foo', + 'expected' => 0, + ], + 'two messages, same property, same severity' => [ + 'property' => 'foo', + 'expected' => 2, + ], + 'two messages, same property, different severity' => [ + 'property' => 'foo', + 'expected' => 2, + ], + 'two messages, different property, same severity' => [ + 'property' => 'foo', + 'expected' => 1, + ], + ] ); } @@ -439,37 +437,37 @@ public function countForPropertyReturnsTotalMessagesForProperty(array $messages, { $this->loadMessages($messages); self::assertSame( - $expectedTotal, - $this->subject->countForProperty($property) + $expectedTotal, + $this->subject->countForProperty($property) ); } public function countForSeverityProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => 1 - ], - 'single message, not requested property, not requested severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => 0 - ], - 'two messages, same property, same severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => 2 - ], - 'two messages, same property, different severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => 1 - ], - 'two messages, different property, same severity' => [ - 'severity' => AbstractMessage::NOTICE, - 'expected' => 2 - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => 1, + ], + 'single message, not requested property, not requested severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => 0, + ], + 'two messages, same property, same severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => 2, + ], + 'two messages, same property, different severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => 1, + ], + 'two messages, different property, same severity' => [ + 'severity' => AbstractMessage::NOTICE, + 'expected' => 2, + ], + ] ); } @@ -484,42 +482,42 @@ public function countForSeverityReturnsTotalMessagesForSeverity(array $messages, { $this->loadMessages($messages); self::assertSame( - $expectedTotal, - $this->subject->countForSeverity($severity) + $expectedTotal, + $this->subject->countForSeverity($severity) ); } public function getForPropertyAndSeverityProvider(): array { return array_merge_recursive( - $this->getSampleMessages(), - [ - 'single message' => [ - 'property' => 'foo', - 'severity' => AbstractMessage::NOTICE, - 'count' => 1 - ], - 'single message, not requested property, not requested severity' => [ - 'property' => 'foo', - 'severity' => AbstractMessage::NOTICE, - 'count' => 0 - ], - 'two messages, same property, same severity' => [ - 'property' => 'foo', - 'severity' => AbstractMessage::NOTICE, - 'count' => 2 - ], - 'two messages, same property, different severity' => [ - 'property' => 'foo', - 'severity' => AbstractMessage::NOTICE, - 'count' => 1 - ], - 'two messages, different property, same severity' => [ - 'property' => 'foo', - 'severity' => AbstractMessage::NOTICE, - 'count' => 1 - ] - ] + $this->getSampleMessages(), + [ + 'single message' => [ + 'property' => 'foo', + 'severity' => AbstractMessage::NOTICE, + 'count' => 1, + ], + 'single message, not requested property, not requested severity' => [ + 'property' => 'foo', + 'severity' => AbstractMessage::NOTICE, + 'count' => 0, + ], + 'two messages, same property, same severity' => [ + 'property' => 'foo', + 'severity' => AbstractMessage::NOTICE, + 'count' => 2, + ], + 'two messages, same property, different severity' => [ + 'property' => 'foo', + 'severity' => AbstractMessage::NOTICE, + 'count' => 1, + ], + 'two messages, different property, same severity' => [ + 'property' => 'foo', + 'severity' => AbstractMessage::NOTICE, + 'count' => 1, + ], + ] ); } @@ -535,8 +533,8 @@ public function getForPropertyAndSeverityReturnsAllMessagesForPropertyAndSeverit { $this->loadMessages($messages); self::assertCount( - $count, - $this->subject->getForPropertyAndSeverity($property, $severity) + $count, + $this->subject->getForPropertyAndSeverity($property, $severity) ); } @@ -549,10 +547,10 @@ protected function loadMessages(array $messages): void { foreach ($messages as $message) { $this->subject->add( - $message['property'], - $message['message'], - $message['severity'] + $message['property'], + $message['message'], + $message['severity'] ); } } -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index af9b01a9..d8a32865 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "typo3/cms-core": "^11.5 || ^12.4", "typo3/cms-extbase": "*", "typo3/cms-scheduler": "^11.5 || ^12.4", + "typo3/coding-standards": "*", "cobweb/svconnector": "^5.0" }, "require-dev": { diff --git a/ext_localconf.php b/ext_localconf.php index 8adfb8e4..1f581f9e 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -10,7 +10,7 @@ 'extension' => 'external_import', 'title' => 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:scheduler.title', 'description' => 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:scheduler.description', - 'additionalFields' => AutomatedSyncAdditionalFieldProvider::class + 'additionalFields' => AutomatedSyncAdditionalFieldProvider::class, ]; // Set up garbage collection @@ -31,14 +31,14 @@ 'sync' => [ 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.runSync', 'actions-refresh', - 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.runSync.description' + 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.runSync.description', ], 'scheduler' => [ 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.scheduler', 'mimetypes-x-tx_scheduler_task_group', - 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.scheduler.description' - ] - ] - ] + 'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:bemodulePermissions.scheduler.description', + ], + ], + ], ] ); diff --git a/ext_tables.php b/ext_tables.php index 2d2da283..fd37d675 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -16,7 +16,7 @@ [ 'access' => 'user,group', 'icon' => 'EXT:external_import/Resources/Public/Icons/MainModuleIcon.svg', - 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/MainModule.xlf' + 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/MainModule.xlf', ] ); // Register the "Data Import" backend module @@ -29,12 +29,12 @@ // Position '', [ - DataModuleController::class => 'listSynchronizable, listNonSynchronizable, synchronize, preview, downloadPreview, viewConfiguration, newTask, createTask, editTask, updateTask, deleteTask' + DataModuleController::class => 'listSynchronizable, listNonSynchronizable, synchronize, preview, downloadPreview, viewConfiguration, newTask, createTask, editTask, updateTask, deleteTask', ], [ 'access' => 'user,group', 'icon' => 'EXT:external_import/Resources/Public/Icons/DataModuleIcon.svg', - 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/DataModule.xlf' + 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/DataModule.xlf', ] ); // Register the "Log" backend module @@ -47,11 +47,11 @@ // Position '', [ - LogModuleController::class => 'list, get' + LogModuleController::class => 'list, get', ], [ 'access' => 'user,group', 'icon' => 'EXT:external_import/Resources/Public/Icons/LogModuleIcon.svg', - 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/LogModule.xlf' + 'labels' => 'LLL:EXT:external_import/Resources/Private/Language/LogModule.xlf', ] );