diff --git a/.php_cs b/.php_cs deleted file mode 100755 index 94a68727..00000000 --- a/.php_cs +++ /dev/null @@ -1,80 +0,0 @@ -exclude('vendor/') - ->in(__DIR__); - -// Return a Code Sniffing configuration using -// all sniffers needed for PSR-2 -// and additionally: -// - Remove leading slashes in use clauses. -// - PHP single-line arrays should not have trailing comma. -// - Single-line whitespace before closing semicolon are prohibited. -// - Remove unused use statements in the PHP source code -// - Ensure Concatenation to have at least one whitespace around -// - Remove trailing whitespace at the end of blank lines. -return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - 'no_leading_import_slash' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_unused_imports' => true, - 'concat_space' => ['spacing' => 'one'], - 'no_whitespace_in_blank_line' => true, - 'ordered_imports' => true, - 'single_quote' => true, - 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => true, - 'phpdoc_no_package' => true, - 'phpdoc_scalar' => true, - 'no_blank_lines_after_phpdoc' => true, - 'array_syntax' => ['syntax' => 'short'], - 'whitespace_after_comma_in_array' => true, - 'function_typehint_space' => true, - 'hash_to_slash_comment' => true, - 'no_alias_functions' => true, - 'lowercase_cast' => true, - 'no_leading_namespace_whitespace' => true, - 'native_function_casing' => true, - 'self_accessor' => true, - 'no_short_bool_cast' => true, - 'no_unneeded_control_parentheses' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_trim' => true - ]) - ->setFinder($finder); diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 8a07473a..00000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,41 +0,0 @@ -filter: - excluded_paths: - - 'Documentation/*' - - 'Tests/*' - paths: - - 'Classes/*' -tools: - - external_code_coverage: - timeout: 2400 - runs: 7 - - php_cpd: - enabled: true - - php_code_sniffer: - enabled: true - config: - standard: PSR2 - - php_cs_fixer: - enabled: true - - php_hhvm: - enabled: true - config: - use_undeclared_constant: false - - php_mess_detector: - enabled: true - config: - controversial_rules: - superglobals: false - - php_pdepend: - enabled: true - - php_analyzer: - enabled: true - - sensiolabs_security_checker: true diff --git a/.styleci.yml b/.styleci.yml deleted file mode 100644 index b4d68fdc..00000000 --- a/.styleci.yml +++ /dev/null @@ -1,33 +0,0 @@ -preset: psr2 -risky: true -enabled: - - no_leading_import_slash - - no_trailing_comma_in_singleline_array - - no_singleline_whitespace_before_semicolons - - no_unused_imports - - concat_with_spaces - - no_whitespace_in_blank_line - - ordered_imports - - single_quote - - no_extra_consecutive_blank_lines - - phpdoc_no_package - - phpdoc_scalar - - no_blank_lines_after_phpdoc - - short_array_syntax - - whitespace_after_comma_in_array - - function_typehint_space - - hash_to_slash_comment - - no_alias_functions - - lowercase_cast - - no_leading_namespace_whitespace - - native_function_casing - - no_empty_statement - - self_accessor - - no_short_bool_cast - - no_unneeded_control_parentheses - -finder: - name: - - "*.php" - not-path: - - "Documentation" diff --git a/Build/FunctionalTests.xml b/Build/FunctionalTests.xml deleted file mode 100644 index a5631f26..00000000 --- a/Build/FunctionalTests.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - ../Tests/Functional/ - - - - - ../Classes/ - - - diff --git a/Build/Local/FunctionalTests.xml b/Build/Local/FunctionalTests.xml deleted file mode 100644 index 350cf30f..00000000 --- a/Build/Local/FunctionalTests.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - ../../Tests/Functional/ - - - - - ../../Classes/ - - - diff --git a/Build/Local/phpunit.xml b/Build/Local/phpunit.xml deleted file mode 100644 index 6c90e96d..00000000 --- a/Build/Local/phpunit.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - ../../Tests/Unit/ - - - - - ../../Classes/ - - - diff --git a/Build/UnitTests.xml b/Build/UnitTests.xml deleted file mode 100644 index 91890ea3..00000000 --- a/Build/UnitTests.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - ../Tests/Unit/ - - - - - ../Classes/ - - - - diff --git a/Classes/Command/GeocodeCommand.php b/Classes/Command/GeocodeCommand.php index 9290246c..a2b46560 100644 --- a/Classes/Command/GeocodeCommand.php +++ b/Classes/Command/GeocodeCommand.php @@ -1,9 +1,10 @@ extensionConfiguration = GeneralUtility::makeInstance(Settings::class); } - public function showAction(Address $address = null) + public function showAction(?Address $address = null) { if (is_a($address, Address::class) && ($this->settings['detail']['checkPidOfAddressRecord'] ?? false)) { $address = $this->checkPidOfAddressRecord($address); @@ -56,7 +54,7 @@ public function showAction(Address $address = null) if ($address !== null) { $provider = GeneralUtility::makeInstance(AddressTitleProvider::class); - $provider->setTitle($address, (array)($this->settings['seo']['pageTitle'] ?? [])); + $provider->setTitle($address, (array) ($this->settings['seo']['pageTitle'] ?? [])); CacheUtility::addCacheTagsByAddressRecords([$address]); } @@ -70,15 +68,14 @@ public function showAction(Address $address = null) /** * Lists addresses by settings in waterfall principle. * singleRecords take precedence over categories which take precedence over records from pages - * */ public function listAction(?array $override = []) { $contentData = $this->configurationManager->getContentObject()->data; $demand = $this->createDemandFromSettings(); - if (isset($contentData['first_name'], $contentData['birthday']) && (int)($this->settings['insertRecord'] ?? 0) === 1) { - $demand->setSingleRecords((string)$contentData['uid']); + if (isset($contentData['first_name'], $contentData['birthday']) && (int) ($this->settings['insertRecord'] ?? 0) === 1) { + $demand->setSingleRecords((string) $contentData['uid']); } if (!empty($override) && $this->settings['allowOverride']) { @@ -130,7 +127,7 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config ); // correct the array to be in same shape like the _SETTINGS array - $tsSettings = $this->removeDots((array)($tsSettings['plugin.']['tx_ttaddress.'] ?? [])); + $tsSettings = $this->removeDots((array) ($tsSettings['plugin.']['tx_ttaddress.'] ?? [])); // get original settings // original means: what extbase does by munching flexform and TypoScript together, but leaving empty flexform-settings empty ... @@ -157,18 +154,18 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config protected function createDemandFromSettings(): Demand { $demand = new Demand(); - $demand->setCategories((string)($this->settings['groups'] ?? '')); - $categoryCombination = (int)($this->settings['groupsCombination'] ?? 1) === 1 ? 'or' : 'and'; + $demand->setCategories((string) ($this->settings['groups'] ?? '')); + $categoryCombination = (int) ($this->settings['groupsCombination'] ?? 1) === 1 ? 'or' : 'and'; $demand->setCategoryCombination($categoryCombination); - $demand->setIncludeSubCategories((bool)($this->settings['includeSubcategories'] ?? false)); + $demand->setIncludeSubCategories((bool) ($this->settings['includeSubcategories'] ?? false)); if ($this->settings['pages'] ?? false) { $demand->setPages($this->getPidList()); } - $demand->setSingleRecords((string)($this->settings['singleRecords'] ?? '')); - $demand->setSortBy((string)($this->settings['sortBy'] ?? '')); - $demand->setSortOrder((string)($this->settings['sortOrder'] ?? '')); - $demand->setIgnoreWithoutCoordinates((bool)($this->settings['ignoreWithoutCoordinates'] ?? false)); + $demand->setSingleRecords((string) ($this->settings['singleRecords'] ?? '')); + $demand->setSortBy((string) ($this->settings['sortBy'] ?? '')); + $demand->setSortOrder((string) ($this->settings['sortOrder'] ?? '')); + $demand->setIgnoreWithoutCoordinates((bool) ($this->settings['ignoreWithoutCoordinates'] ?? false)); return $demand; } @@ -198,9 +195,6 @@ protected function overrideDemand(Demand $demand, array $override = []): Demand return $demand; } - /** - * @param AddressRepository $addressRepository - */ public function injectAddressRepository(AddressRepository $addressRepository) { $this->addressRepository = $addressRepository; @@ -225,11 +219,10 @@ protected function removeDots(array $settings): array * Removes a dot in the end of a String * * @param string $string - * @return string */ protected function removeDotAtTheEnd($string): string { - return preg_replace('/\.$/', '', (string)$string); + return preg_replace('/\.$/', '', (string) $string); } /** @@ -244,7 +237,7 @@ protected function getPidList(): array // iterate through root-page ids and merge to array foreach ($rootPIDs as $pid) { - $result = $this->queryGenerator->getTreeList($pid, (int)($this->settings['recursive'] ?? 0)); + $result = $this->queryGenerator->getTreeList($pid, (int) ($this->settings['recursive'] ?? 0)); if ($result) { $subtreePids = explode(',', $result); $pidList = array_merge($pidList, $subtreePids); @@ -260,8 +253,8 @@ protected function getPidList(): array */ protected function getPaginator($addresses): PaginatorInterface { - $currentPage = $this->request->hasArgument('currentPage') ? (int)$this->request->getArgument('currentPage') : 1; - $itemsPerPage = (int)($this->settings['paginate']['itemsPerPage'] ?? 10); + $currentPage = $this->request->hasArgument('currentPage') ? (int) $this->request->getArgument('currentPage') : 1; + $itemsPerPage = (int) ($this->settings['paginate']['itemsPerPage'] ?? 10); if ($itemsPerPage === 0) { $itemsPerPage = 10; } @@ -279,9 +272,6 @@ protected function getPaginator($addresses): PaginatorInterface /** * Checks if the address PID could be found in the storagePage settings of the detail plugin and * if the pid is not found null is returned - * - * @param Address $address - * @return Address|null */ protected function checkPidOfAddressRecord(Address $address): ?Address { diff --git a/Classes/Database/QueryGenerator.php b/Classes/Database/QueryGenerator.php index 8d1992e0..6239cdde 100644 --- a/Classes/Database/QueryGenerator.php +++ b/Classes/Database/QueryGenerator.php @@ -1,4 +1,5 @@ - */ + /** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> */ protected $image; - /** - * @var string - */ + /** @var string */ protected $description = ''; - /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage - */ + /** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ protected $categories; public function __construct() @@ -282,17 +217,11 @@ public function getTitle(): string return $this->title; } - /** - * @return string - */ public function getTitleSuffix(): string { return $this->titleSuffix; } - /** - * @param string $titleSuffix - */ public function setTitleSuffix(string $titleSuffix): void { $this->titleSuffix = $titleSuffix; @@ -627,8 +556,6 @@ public function getSysLanguageUid(): int /** * Get full name including title, first, middle and last name - * - * @return string */ public function getFullName(): string { diff --git a/Classes/Domain/Model/Dto/Demand.php b/Classes/Domain/Model/Dto/Demand.php index 1ba4b2b8..ccb2a2f5 100644 --- a/Classes/Domain/Model/Dto/Demand.php +++ b/Classes/Domain/Model/Dto/Demand.php @@ -1,4 +1,5 @@ pages; } - /** - * @param array $pages - */ public function setPages(array $pages) { $this->pages = $pages; } - /** - * @return string - */ public function getSortBy(): string { return $this->sortBy; } - /** - * @param string $sortBy - */ public function setSortBy(string $sortBy) { $this->sortBy = $sortBy; } - /** - * @return string - */ public function getSortOrder(): string { return $this->sortOrder; } - /** - * @param string $sortOrder - */ public function setSortOrder(string $sortOrder) { $this->sortOrder = $sortOrder; } - /** - * @return string - */ public function getCategories(): string { return $this->categories; } - /** - * @param string $categories - */ public function setCategories(string $categories) { $this->categories = $categories; } - /** - * @return bool - */ public function getIncludeSubCategories(): bool { return $this->includeSubCategories; } - /** - * @param bool $includeSubCategories - */ public function setIncludeSubCategories(bool $includeSubCategories) { $this->includeSubCategories = $includeSubCategories; } - /** - * @return string - */ public function getCategoryCombination(): string { return $this->categoryCombination; } - /** - * @param string $categoryCombination - */ public function setCategoryCombination(string $categoryCombination) { $this->categoryCombination = $categoryCombination; } - /** - * @return string - */ public function getSingleRecords(): string { return $this->singleRecords; } - /** - * @param string $singleRecords - */ public function setSingleRecords(string $singleRecords) { $this->singleRecords = $singleRecords; } - /** - * @return bool - */ public function getIgnoreWithoutCoordinates(): bool { return $this->ignoreWithoutCoordinates; } - /** - * @param bool $ignoreWithoutCoordinates - */ public function setIgnoreWithoutCoordinates(bool $ignoreWithoutCoordinates) { $this->ignoreWithoutCoordinates = $ignoreWithoutCoordinates; diff --git a/Classes/Domain/Model/Dto/Settings.php b/Classes/Domain/Model/Dto/Settings.php index 313c1618..e12196bb 100755 --- a/Classes/Domain/Model/Dto/Settings.php +++ b/Classes/Domain/Model/Dto/Settings.php @@ -1,9 +1,10 @@ getSettings(); if (!empty($settings)) { - $this->newPagination = (bool)($settings['newPagination'] ?? false); + $this->newPagination = (bool) ($settings['newPagination'] ?? false); if ($settings['telephoneValidationPatternForPhp'] ?? '') { - $this->telephoneValidationPatternForPhp = (string)$settings['telephoneValidationPatternForPhp']; + $this->telephoneValidationPatternForPhp = (string) $settings['telephoneValidationPatternForPhp']; } if ($settings['telephoneValidationPatternForJs'] ?? '') { - $this->telephoneValidationPatternForJs = (string)$settings['telephoneValidationPatternForJs']; + $this->telephoneValidationPatternForJs = (string) $settings['telephoneValidationPatternForJs']; } } } - /** - * @return string - */ public function getTelephoneValidationPatternForPhp(): string { return $this->telephoneValidationPatternForPhp; } - /** - * @return string - */ public function getTelephoneValidationPatternForJs(): string { return $this->telephoneValidationPatternForJs; diff --git a/Classes/Domain/Repository/AddressRepository.php b/Classes/Domain/Repository/AddressRepository.php index 358a22a2..0d0d1c2f 100755 --- a/Classes/Domain/Repository/AddressRepository.php +++ b/Classes/Domain/Repository/AddressRepository.php @@ -1,9 +1,10 @@ $value) { // prefix array keys with ':' - $params[':' . $key] = (\is_numeric($value)) ? $value : "'" . $value . "'"; //all non numeric values have to be quoted + $params[':' . $key] = (\is_numeric($value)) ? $value : "'" . $value . "'"; // all non numeric values have to be quoted unset($params[$key]); } // replace placeholders with real values - $query = strtr($queryBuilder->getSQL(), $params); - return $query; + return strtr($queryBuilder->getSQL(), $params); } /** - * @param Demand $demand * @return array|QueryResultInterface * @throws InvalidQueryException */ @@ -138,7 +132,7 @@ public function getAddressesByCustomSorting(Demand $demand) $query->setOrderings([$sortBy => $order]); $constraints = [ - $query->in('uid', $idList) + $query->in('uid', $idList), ]; $query->matching($query->logicalAnd(...$constraints)); @@ -164,10 +158,6 @@ public function getAddressesByCustomSorting(Demand $demand) * Returns a category constraint created by * a given list of categories and a junction string * - * @param QueryInterface $query - * @param string $categories - * @param bool $includeSubCategories - * @return array * @throws InvalidQueryException */ protected function createCategoryConstraint(QueryInterface $query, string $categories, bool $includeSubCategories = false): array diff --git a/Classes/Evaluation/LatitudeEvaluation.php b/Classes/Evaluation/LatitudeEvaluation.php index 25ff8d42..3effcea6 100755 --- a/Classes/Evaluation/LatitudeEvaluation.php +++ b/Classes/Evaluation/LatitudeEvaluation.php @@ -1,9 +1,10 @@ data['databaseRow']; @@ -50,7 +46,7 @@ public function render(): array // base url $geoCodeUrlBase = 'https://nominatim.openstreetmap.org/search?q='; $geoCodeUrlAddress = $address; - $geoCodeUrlCityOnly = ($row['city'] ?? ''); + $geoCodeUrlCityOnly = $row['city'] ?? ''; // urlparams for nominatim which are fixed. $geoCodeUrlQuery = '&format=json&addressdetails=1&limit=1&polygon_svg=1'; // replace newlines with spaces; remove multiple spaces @@ -90,9 +86,6 @@ public function render(): array return $resultArray; } - /** - * @return LanguageService - */ protected function getLanguageService(): LanguageService { return $GLOBALS['LANG']; diff --git a/Classes/FormEngine/TtAddressPreviewRenderer.php b/Classes/FormEngine/TtAddressPreviewRenderer.php index d860a382..8d868c77 100644 --- a/Classes/FormEngine/TtAddressPreviewRenderer.php +++ b/Classes/FormEngine/TtAddressPreviewRenderer.php @@ -1,9 +1,10 @@ $field, - 'label' => $label + 'label' => $label, ]; } // add sorting by order of single selection $selectOptions[] = [ 'field' => 'singleSelection', - 'label' => $this->languageService->sL('LLL:EXT:tt_address/Resources/Private/Language/ff/locallang_ff.xlf:pi1_flexform.sortBy.singleSelection') + 'label' => $this->languageService->sL('LLL:EXT:tt_address/Resources/Private/Language/ff/locallang_ff.xlf:pi1_flexform.sortBy.singleSelection'), ]; // sort by labels @@ -63,7 +61,7 @@ public function main(array &$params) foreach ($selectOptions as $option) { $params['items'][] = [ $option['label'], - $option['field'] + $option['field'], ]; } } diff --git a/Classes/Hooks/Tca/Label.php b/Classes/Hooks/Tca/Label.php index efa3094c..41881339 100755 --- a/Classes/Hooks/Tca/Label.php +++ b/Classes/Hooks/Tca/Label.php @@ -1,9 +1,10 @@ timeTracker->setTSlogMessage('EXT:tt_address: one or more recursive categories where found'); return implode(',', $result); } - $subcategories = $this->getChildrenCategoriesRecursive((string)$row['uid'], $counter); + $subcategories = $this->getChildrenCategoriesRecursive((string) $row['uid'], $counter); $result[] = $row['uid'] . ($subcategories ? ',' . $subcategories : ''); } - $result = implode(',', $result); - return $result; + return implode(',', $result); } /** * Fetch ids again from DB to avoid false positives - * - * @param string $idList - * @return string */ protected function getUidListFromRecords(string $idList): string { diff --git a/Classes/Service/GeocodeService.php b/Classes/Service/GeocodeService.php index ec7b8893..9f4249ba 100755 --- a/Classes/Service/GeocodeService.php +++ b/Classes/Service/GeocodeService.php @@ -1,10 +1,11 @@ $coords['longitude'], ], [ - 'uid' => $record['uid'] + 'uid' => $record['uid'], ] ); } @@ -152,10 +152,6 @@ public function getCoordinatesForAddress($street = null, $zip = null, $city = nu return $result; } - /** - * @param string $url - * @return array - */ protected function getApiCallResult(string $url): array { $response = GeneralUtility::getUrl($url); @@ -169,7 +165,6 @@ protected function getApiCallResult(string $url): array /** * Initializes the cache for the DB requests. * - * @param string $name * @return FrontendInterface Cache Object */ protected function initializeCache(string $name = 'ttaddress_geocoding'): FrontendInterface diff --git a/Classes/Utility/CacheUtility.php b/Classes/Utility/CacheUtility.php index b1f7b9a3..cb785676 100644 --- a/Classes/Utility/CacheUtility.php +++ b/Classes/Utility/CacheUtility.php @@ -1,9 +1,10 @@ getLatitude() . ',' . $address->getLongitude(); } if (count($markers) === 1) { diff --git a/Configuration/ContentSecurityPolicies.php b/Configuration/ContentSecurityPolicies.php index 8141e101..c2935fd9 100644 --- a/Configuration/ContentSecurityPolicies.php +++ b/Configuration/ContentSecurityPolicies.php @@ -1,4 +1,5 @@ [ - 'tableName' => 'tt_address' - ] + 'tableName' => 'tt_address', + ], ]; diff --git a/Configuration/JavaScriptModules.php b/Configuration/JavaScriptModules.php index 425ced55..f8ed8fb7 100644 --- a/Configuration/JavaScriptModules.php +++ b/Configuration/JavaScriptModules.php @@ -1,4 +1,5 @@ [ 'label' => 'pid', 'config' => [ - 'type' => 'passthrough' - ] + 'type' => 'passthrough', + ], ], 'crdate' => [ 'label' => 'crdate', 'config' => [ 'type' => 'datetime', - ] + ], ], 'tstamp' => [ 'label' => 'tstamp', 'config' => [ 'type' => 'datetime', - ] + ], ], 'hidden' => [ 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', 'config' => [ - 'type' => 'check' - ] + 'type' => 'check', + ], ], 'starttime' => [ 'exclude' => true, 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel', 'config' => [ 'type' => 'datetime', - ] + ], ], 'endtime' => [ 'exclude' => true, 'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', 'config' => [ 'type' => 'datetime', - ] + ], ], 'fe_group' => [ 'exclude' => true, @@ -94,7 +94,7 @@ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', 'config' => [ 'type' => 'language', - ] + ], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -108,13 +108,13 @@ 'default' => 0, 'foreign_table' => 'tt_address', 'foreign_table_where' => 'AND tt_address.pid=###CURRENT_PID### AND tt_address.sys_language_uid IN (-1,0)', - ] + ], ], 'l10n_diffsource' => [ 'config' => [ 'type' => 'passthrough', - 'default' => '' - ] + 'default' => '', + ], ], 'gender' => [ 'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender', @@ -127,9 +127,9 @@ ['label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender.m', 'value' => 'm'], ['label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender.f', 'value' => 'f'], ['label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender.v', 'value' => 'v'], - ['label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender.undefined', 'value' => ''] - ] - ] + ['label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.gender.undefined', 'value' => ''], + ], + ], ], 'title' => [ 'exclude' => true, @@ -142,7 +142,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'title_suffix' => [ 'exclude' => true, @@ -155,7 +155,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'slug' => [ 'exclude' => true, @@ -168,13 +168,13 @@ 'fields' => ['first_name', 'middle_name', 'last_name'], 'fieldSeparator' => '-', 'replacements' => [ - '/' => '-' + '/' => '-', ], ], 'fallbackCharacter' => '-', 'eval' => 'unique', - 'default' => '' - ] + 'default' => '', + ], ], 'name' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.name', @@ -182,8 +182,8 @@ 'type' => 'input', 'size' => 40, 'eval' => 'trim', - 'max' => 255 - ] + 'max' => 255, + ], ], 'first_name' => [ 'exclude' => false, @@ -194,8 +194,8 @@ 'type' => 'input', 'size' => 20, 'eval' => 'trim', - 'max' => 255 - ] + 'max' => 255, + ], ], 'middle_name' => [ 'exclude' => false, @@ -206,8 +206,8 @@ 'type' => 'input', 'size' => 20, 'eval' => 'trim', - 'max' => 255 - ] + 'max' => 255, + ], ], 'last_name' => [ 'exclude' => false, @@ -218,8 +218,8 @@ 'type' => 'input', 'size' => 20, 'eval' => 'trim', - 'max' => 255 - ] + 'max' => 255, + ], ], 'birthday' => [ 'exclude' => true, @@ -227,7 +227,7 @@ 'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.birthday', 'config' => [ 'type' => 'datetime', - ] + ], ], 'address' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.address', @@ -238,7 +238,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'building' => [ 'exclude' => true, @@ -251,7 +251,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'room' => [ 'exclude' => true, @@ -264,7 +264,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'phone' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.phone', @@ -276,7 +276,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'fax' => [ 'exclude' => true, @@ -289,7 +289,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'mobile' => [ 'exclude' => true, @@ -302,7 +302,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'www' => [ 'exclude' => true, @@ -318,7 +318,7 @@ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.email', 'config' => [ 'type' => 'email', - ] + ], ], 'skype' => [ 'exclude' => true, @@ -332,7 +332,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'twitter' => [ 'exclude' => true, @@ -346,7 +346,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'facebook' => [ 'exclude' => true, @@ -360,7 +360,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'instagram' => [ 'exclude' => true, @@ -374,7 +374,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'tiktok' => [ 'exclude' => true, @@ -388,7 +388,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'linkedin' => [ 'exclude' => true, @@ -402,7 +402,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'company' => [ 'exclude' => true, @@ -415,7 +415,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'position' => [ 'exclude' => true, @@ -428,7 +428,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'city' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.city', @@ -440,7 +440,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'zip' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.zip', @@ -452,7 +452,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'region' => [ 'exclude' => true, @@ -465,7 +465,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'country' => [ 'exclude' => true, @@ -478,7 +478,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'image' => [ 'exclude' => true, @@ -497,32 +497,32 @@ 'types' => [ '0' => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ 'showitem' => ' - --palette--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette', ], ], @@ -543,7 +543,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'categories' => [ 'exclude' => true, @@ -553,7 +553,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'latitude' => [ 'exclude' => true, @@ -565,7 +565,7 @@ 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], 'longitude' => [ 'exclude' => true, @@ -576,13 +576,13 @@ 'default' => null, 'fieldControl' => [ 'locationMap' => [ - 'renderType' => 'locationMapWizard' - ] + 'renderType' => 'locationMapWizard', + ], ], 'behaviour' => [ 'allowLanguageSynchronization' => true, ], - ] + ], ], ], 'types' => [ @@ -604,39 +604,39 @@ --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, --palette--;;paletteHidden, --palette--;;paletteAccess, - --div--;' . 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category, categories - ' - ] + --div--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_category.tabs.category, categories + ', + ], ], 'palettes' => [ 'name' => [ 'showitem' => 'gender, title, title_suffix,--linebreak--, - first_name, middle_name, last_name,--linebreak--,name,--linebreak--,slug' + first_name, middle_name, last_name,--linebreak--,name,--linebreak--,slug', ], 'organization' => [ - 'showitem' => 'position, company' + 'showitem' => 'position, company', ], 'address' => [ 'showitem' => 'address, --linebreak--, city, zip, region, --linebreak--, - country, --linebreak--,' + country, --linebreak--,', ], 'building' => [ - 'showitem' => 'building, room' + 'showitem' => 'building, room', ], 'coordinates' => [ - 'showitem' => 'latitude,longitude' + 'showitem' => 'latitude,longitude', ], 'contact' => [ 'showitem' => 'email, --linebreak--, phone, mobile, fax, --linebreak--, www, --linebreak--, - birthday' + birthday', ], 'social' => [ 'showitem' => 'skype, twitter, --linebreak--, linkedin, tiktok, --linebreak--, - facebook, instagram' + facebook, instagram', ], 'paletteHidden' => [ 'showitem' => 'hidden', diff --git a/Makefile b/Makefile deleted file mode 100644 index 2fe4b8bf..00000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.PHONY: help -help: ## Displays this list of targets with descriptions - @echo "The following commands are available:\n" - @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' - -.PHONY: docs -docs: ## Generate projects docs (from "Documentation" directory) - mkdir -p Documentation-GENERATED-temp - - docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation - -.PHONY: codesnippets -codesnippets: ## Regenerate automatic code snippets - .Build/vendor/bin/typo3 codesnippet:create Documentation/CodeSnippets/ diff --git a/Tests/Functional/Repository/AddressRepositoryTest.php b/Tests/Functional/Repository/AddressRepositoryTest.php index eb1d1deb..dac52426 100644 --- a/Tests/Functional/Repository/AddressRepositoryTest.php +++ b/Tests/Functional/Repository/AddressRepositoryTest.php @@ -1,9 +1,10 @@ getMajorVersion() >= 12) { $sql = 'SELECT `tt_address`.* FROM `tt_address` `tt_address` WHERE (((((`tt_address`.`pid` IN (1, 2)) AND ( NOT(((`tt_address`.`latitude` IS NULL) OR (`tt_address`.`latitude` = 0)))))) AND ( NOT(((`tt_address`.`longitude` IS NULL) OR (`tt_address`.`longitude` = 0)))))) AND (`tt_address`.`sys_language_uid` IN (0, -1)) AND (`tt_address`.`t3ver_oid` = 0) AND (((`tt_address`.`hidden` = 0) AND (`tt_address`.`starttime` <= ' . $time . ') AND (((`tt_address`.`endtime` = 0) OR (`tt_address`.`endtime` > ' . $time . ')))) AND tt_address.deleted=0)'; } - $this->assertEquals($sql, $result); + self::assertEquals($sql, $result); } /** @@ -59,7 +58,7 @@ public function rawQueryReturnsCorrectQuery() public function findRecordsByUid() { $address = $this->addressRepository->findByIdentifier(1); - $this->assertEquals($address->getFirstName(), 'John'); + self::assertEquals('John', $address->getFirstName()); } /** @@ -72,7 +71,7 @@ public function findRecordsByCustomSorting() $demand->setSingleRecords('3,6,2'); $addresses = $this->addressRepository->getAddressesByCustomSorting($demand); - $this->assertEquals([3, 6, 2], $this->getListOfIds($addresses)); + self::assertEquals([3, 6, 2], $this->getListOfIds($addresses)); } /** @@ -87,7 +86,7 @@ public function findRecordsByCustomSortingDesc() $demand->setSortOrder('DESC'); $addresses = $this->addressRepository->getAddressesByCustomSorting($demand); - $this->assertEquals([2, 6, 3], $this->getListOfIds($addresses)); + self::assertEquals([2, 6, 3], $this->getListOfIds($addresses)); } /** @@ -101,7 +100,7 @@ public function findRecordsByCustomSortingAndSortFieldDesc() $demand->setSortOrder('DESC'); $addresses = $this->addressRepository->getAddressesByCustomSorting($demand); - $this->assertEquals([3, 2, 6], $this->getListOfIds($addresses)); + self::assertEquals([3, 2, 6], $this->getListOfIds($addresses)); } /** @@ -114,7 +113,7 @@ public function findRecordsByPageAndCustomSortingDesc() $demand->setSortBy('lastName'); $demand->setSortOrder('DESC'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([7, 5, 6], $this->getListOfIds($addresses)); + self::assertEquals([7, 5, 6], $this->getListOfIds($addresses)); } /** @@ -126,7 +125,7 @@ public function findRecordsByPageAndCustomSortingAsc() $demand->setPages(['2', '10', '', '3']); $demand->setSortBy('lastName'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([6, 5, 7], $this->getListOfIds($addresses)); + self::assertEquals([6, 5, 7], $this->getListOfIds($addresses)); } /** @@ -139,15 +138,15 @@ public function findRecordsByCategory() $demand->setSortBy('uid'); $demand->setCategories('5'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([2, 5, 6], $this->getListOfIds($addresses)); + self::assertEquals([2, 5, 6], $this->getListOfIds($addresses)); $demand->setCategories('5,6'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([2], $this->getListOfIds($addresses)); + self::assertEquals([2], $this->getListOfIds($addresses)); $demand->setCategoryCombination('or'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([2, 5, 6, 7], $this->getListOfIds($addresses)); + self::assertEquals([2, 5, 6, 7], $this->getListOfIds($addresses)); } /** @@ -161,11 +160,11 @@ public function findRecordsByCategoryWithSubCheck() $demand->setCategoryCombination('or'); $demand->setCategories('1'); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([1, 6], $this->getListOfIds($addresses)); + self::assertEquals([1, 6], $this->getListOfIds($addresses)); $demand->setIncludeSubCategories(true); $addresses = $this->addressRepository->findByDemand($demand); - $this->assertEquals([1, 6, 8], $this->getListOfIds($addresses)); + self::assertEquals([1, 6, 8], $this->getListOfIds($addresses)); } /** @@ -180,13 +179,11 @@ public function findRecordsByCoordinates() foreach ($addresses as $a) { echo $a->getUid() . ' - ' . $a->getLongitude() . '/' . $a->getLatitude() . chr(10); } - $this->assertEquals([14], $this->getListOfIds($addresses)); + self::assertEquals([14], $this->getListOfIds($addresses)); } /** * @param Address[] $list - * @param string $field - * @return array */ private function getListOfIds($list, string $field = 'uid'): array { diff --git a/Tests/Functional/Service/CategoryServiceTest.php b/Tests/Functional/Service/CategoryServiceTest.php index cde02a6b..2f787b0a 100644 --- a/Tests/Functional/Service/CategoryServiceTest.php +++ b/Tests/Functional/Service/CategoryServiceTest.php @@ -1,9 +1,10 @@ subject->getChildrenCategories('2,4'); - $this->assertEquals('2,4,20,21,211,212,30,31,32', $categories); + self::assertEquals('2,4,20,21,211,212,30,31,32', $categories); $categories = $this->subject->getChildrenCategories('4,5,10919,6,7,8'); - $this->assertEquals('4,5,8', $categories); + self::assertEquals('4,5,8', $categories); } /** @@ -49,7 +49,7 @@ public function findChildCategories() public function loggerInvokedWithTooManyCategories() { $mockedTimeTracker = $this->getAccessibleMock(TimeTracker::class, ['setTSlogMessage'], [], '', false); - $mockedTimeTracker->expects($this->any())->method('setTSlogMessage'); + $mockedTimeTracker->expects(self::any())->method('setTSlogMessage'); $subject = $this->getAccessibleMock(CategoryService::class, null, [], '', false); $subject->_set('timeTracker', $mockedTimeTracker); diff --git a/Tests/Functional/Service/GeocodeServiceTest.php b/Tests/Functional/Service/GeocodeServiceTest.php index 5e967080..f21b6c3f 100644 --- a/Tests/Functional/Service/GeocodeServiceTest.php +++ b/Tests/Functional/Service/GeocodeServiceTest.php @@ -1,9 +1,10 @@ getAccessibleMock(GeocodeService::class, ['getCoordinatesForAddress'], ['123']); - $subject->expects($this->any())->method('getCoordinatesForAddress') + $subject->expects(self::any())->method('getCoordinatesForAddress') ->withConsecutive([], [], []) ->willReturnOnConsecutiveCalls( ['latitude' => 10.000, 'longitude' => 12.000], @@ -42,10 +43,10 @@ public function properRecordsAreFound() ); $count = $subject->calculateCoordinatesForAllRecordsInTable('pid=100'); - $this->assertEquals(3, $count); + self::assertEquals(3, $count); $row = BackendUtility::getRecord('tt_address', 21); - $this->assertEquals(['latitude' => $row['latitude'], 'longitude' => $row['longitude']], ['latitude' => 10.000000000000, 'longitude' => 12.000000000000]); + self::assertEquals(['latitude' => 10.000000000000, 'longitude' => 12.000000000000], ['latitude' => $row['latitude'], 'longitude' => $row['longitude']]); } /** @@ -57,15 +58,15 @@ public function urlforAddressesIsBuiltCorrectly() $resultEmpty = ['results' => []]; $subject = $this->getAccessibleMock(GeocodeService::class, ['getApiCallResult'], ['123']); - $subject->expects($this->any())->method('getApiCallResult') + $subject->expects(self::any())->method('getApiCallResult') ->willReturnOnConsecutiveCalls($result1, $resultEmpty); $response = $subject->getCoordinatesForAddress('DummyStr', '1', 'London', 'UK'); - $this->assertEquals($response, ['latitude' => 11, 'longitude' => '13']); + self::assertEquals(['latitude' => 11, 'longitude' => '13'], $response); $response2 = $subject->getCoordinatesForAddress('DummyStr', '1', 'London', 'UK'); $response3 = $subject->getCoordinatesForAddress('DummyStr', '2', 'Vienna', 'UK'); $response4 = $subject->getCoordinatesForAddress(); - $this->assertEquals([], $response4); + self::assertEquals([], $response4); } /** @@ -73,6 +74,6 @@ public function urlforAddressesIsBuiltCorrectly() */ public function findRecordsByUid() { - $this->assertTrue(true); + self::assertTrue(true); } } diff --git a/Tests/Unit/Command/GeocodeCommandTest.php b/Tests/Unit/Command/GeocodeCommandTest.php index fe6469f5..b8e7e5fd 100644 --- a/Tests/Unit/Command/GeocodeCommandTest.php +++ b/Tests/Unit/Command/GeocodeCommandTest.php @@ -1,9 +1,10 @@ getAccessibleMock(GeocodeCommand::class, ['addArgument'], [], '', false); $subject->_call('configure'); - $this->assertEquals('Geocode tt_address records', $subject->getDescription()); + self::assertEquals('Geocode tt_address records', $subject->getDescription()); } /** @@ -34,7 +35,7 @@ public function geocodeServiceIsReturned() { $subject = $this->getAccessibleMock(GeocodeCommand::class, null, [], '', false); $service = $subject->_call('getGeocodeService', '123'); - $this->assertEquals(GeocodeService::class, get_class($service)); + self::assertInstanceOf(GeocodeService::class, $service); } /** @@ -43,13 +44,13 @@ public function geocodeServiceIsReturned() public function geocodingIsCalled() { $geocodeService = $this->getAccessibleMock(GeocodeService::class, ['calculateCoordinatesForAllRecordsInTable'], [], '', false); - $geocodeService->expects($this->once())->method('calculateCoordinatesForAllRecordsInTable'); + $geocodeService->expects(self::once())->method('calculateCoordinatesForAllRecordsInTable'); $subject = $this->getAccessibleMock(GeocodeCommand::class, ['getGeocodeService'], [], '', false); - $subject->expects($this->once())->method('getGeocodeService')->willReturn($geocodeService); + $subject->expects(self::once())->method('getGeocodeService')->willReturn($geocodeService); $input = $this->getAccessibleMock(StringInput::class, ['getArgument'], [], '', false); - $input->expects($this->once())->method('getArgument')->willReturn('123'); + $input->expects(self::once())->method('getArgument')->willReturn('123'); $output = $this->getAccessibleMock(ConsoleOutput::class, null, []); $subject->_call('execute', $input, $output); diff --git a/Tests/Unit/Controller/AddressControllerPaginationTest.php b/Tests/Unit/Controller/AddressControllerPaginationTest.php index d0958009..3ba3e0b5 100644 --- a/Tests/Unit/Controller/AddressControllerPaginationTest.php +++ b/Tests/Unit/Controller/AddressControllerPaginationTest.php @@ -2,7 +2,7 @@ namespace FriendsOfTypo3\TtAddress\Tests\Unit\Controller; -/** +/* * This file is part of the "tt_address" Extension for TYPO3 CMS. * * For the full copyright and license information, please read the @@ -35,14 +35,14 @@ protected function setUp(): void public function listActionUsesNewPaginationWithArrayRecords() { if (!class_exists(SimplePagination::class)) { - $this->markTestSkipped('Ignore test as new pagination is not available'); + self::markTestSkipped('Ignore test as new pagination is not available'); } $settings = [ 'singlePid' => 0, 'singleRecords' => 1, 'paginate' => [ - 'itemsPerPage' => 3 - ] + 'itemsPerPage' => 3, + ], ]; $demand = new Demand(); $demand->setSingleRecords('134'); @@ -53,7 +53,7 @@ public function listActionUsesNewPaginationWithArrayRecords() for ($i = 1; $i <= 10; $i++) { $rows[] = [ 'uid' => $i, - 'title' => 'record #' . $i + 'title' => 'record #' . $i, ]; } $assignments = [ @@ -62,15 +62,15 @@ public function listActionUsesNewPaginationWithArrayRecords() 'contentObjectData' => [], ]; - $mockedRepository->expects($this->once())->method('getAddressesByCustomSorting')->willReturn($rows); + $mockedRepository->expects(self::once())->method('getAddressesByCustomSorting')->willReturn($rows); $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument'], [], '', false); - $mockedRequest->expects($this->once())->method('hasArgument')->with('currentPage')->willReturn(true); - $mockedRequest->expects($this->once())->method('getArgument')->with('currentPage')->willReturn(2); + $mockedRequest->expects(self::once())->method('hasArgument')->with('currentPage')->willReturn(true); + $mockedRequest->expects(self::once())->method('getArgument')->with('currentPage')->willReturn(2); $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); - $mockedView->expects($this->once())->method('assignMultiple')->with($assignments); - $mockedView->expects($this->any())->method('assign') + $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); + $mockedView->expects(self::any())->method('assign') ->withConsecutive( ['newPagination', true], ['pagination'] // the result can't be mocked, therefore just testing if it exists @@ -82,8 +82,8 @@ public function listActionUsesNewPaginationWithArrayRecords() ->willReturn($mockContentObject); $subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false); - $subject->expects($this->once())->method('createDemandFromSettings')->willReturn($demand); - $subject->expects($this->once())->method('htmlResponse'); + $subject->expects(self::once())->method('createDemandFromSettings')->willReturn($demand); + $subject->expects(self::once())->method('htmlResponse'); $subject->_set('settings', $settings); $subject->_set('view', $mockedView); $subject->_set('request', $mockedRequest); @@ -100,28 +100,28 @@ public function listActionUsesNewPaginationWithArrayRecords() public function paginationIsCorrectlyTriggered() { if (!class_exists(SimplePagination::class)) { - $this->markTestSkipped('Ignore test as new pagination is not available'); + self::markTestSkipped('Ignore test as new pagination is not available'); } $settings = [ 'singlePid' => 0, 'singleRecords' => 1, 'paginate' => [ - 'itemsPerPage' => 3 - ] + 'itemsPerPage' => 3, + ], ]; $rows = []; for ($i = 1; $i <= 10; $i++) { $rows[] = [ 'uid' => $i, - 'title' => 'record #' . $i + 'title' => 'record #' . $i, ]; } $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument'], [], '', false); - $mockedRequest->expects($this->once())->method('hasArgument')->with('currentPage')->willReturn(true); - $mockedRequest->expects($this->once())->method('getArgument')->with('currentPage')->willReturn(2); + $mockedRequest->expects(self::once())->method('hasArgument')->with('currentPage')->willReturn(true); + $mockedRequest->expects(self::once())->method('getArgument')->with('currentPage')->willReturn(2); $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); $subject->_set('settings', $settings); @@ -129,13 +129,13 @@ public function paginationIsCorrectlyTriggered() /** @var PaginatorInterface $paginator */ $paginator = $subject->_call('getPaginator', $rows); - $this->assertEquals($paginator->getPaginatedItems(), array_splice($rows, 3, 3)); + self::assertEquals($paginator->getPaginatedItems(), array_splice($rows, 3, 3)); } protected function getMockedSettings() { $mockedSettings = $this->getAccessibleMock(Settings::class, ['getSettings'], [], '', false); - $mockedSettings->expects($this->any())->method('getSettings')->willReturn([]); + $mockedSettings->expects(self::any())->method('getSettings')->willReturn([]); return $mockedSettings; } diff --git a/Tests/Unit/Controller/AddressControllerTest.php b/Tests/Unit/Controller/AddressControllerTest.php index e466a68c..10c4c4f6 100644 --- a/Tests/Unit/Controller/AddressControllerTest.php +++ b/Tests/Unit/Controller/AddressControllerTest.php @@ -1,9 +1,10 @@ getAccessibleMock(AddressController::class, null, [], '', false); - $this->assertEquals($expected, $subject->_call('removeDotAtTheEnd', $given)); + self::assertEquals($expected, $subject->_call('removeDotAtTheEnd', $given)); } public function dotIsRemovedFromEndDataProvider(): array @@ -80,7 +79,7 @@ public function dotsAreRemovedFromArray() 'sub-with-dot' => 'stringvalue', ], ]; - $this->assertEquals($expected, $subject->_call('removeDots', $given)); + self::assertEquals($expected, $subject->_call('removeDots', $given)); } /** @@ -97,7 +96,7 @@ public function initializeActionWorks() $expected = new QueryGenerator(); - $this->assertEquals($expected, $subject->_get('queryGenerator')); + self::assertEquals($expected, $subject->_get('queryGenerator')); } /** @@ -110,7 +109,7 @@ public function injectAddressRepositoryWorks() $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); $subject->injectAddressRepository($mockedRepository); - $this->assertEquals($mockedRepository, $subject->_get('addressRepository')); + self::assertEquals($mockedRepository, $subject->_get('addressRepository')); } /** @@ -119,7 +118,7 @@ public function injectAddressRepositoryWorks() public function pidListIsReturned() { $mockedQueryGenerator = $this->getAccessibleMock(QueryGenerator::class, ['getTreeList'], [], '', false); - $mockedQueryGenerator->expects($this->any())->method('getTreeList') + $mockedQueryGenerator->expects(self::any())->method('getTreeList') ->withConsecutive([123, 3], [456, 3]) ->willReturnOnConsecutiveCalls('7,8,9', ''); @@ -130,7 +129,7 @@ public function pidListIsReturned() 'recursive' => 3, ]); - $this->assertEquals(['123', '456', '7', '8', '9'], $subject->_call('getPidList')); + self::assertEquals(['123', '456', '7', '8', '9'], $subject->_call('getPidList')); } /** @@ -138,9 +137,9 @@ public function pidListIsReturned() */ public function settingsAreProperlyInjected() { - $this->markTestSkipped('Skipped until fixed'); + self::markTestSkipped('Skipped until fixed'); $mockedConfigurationManager = $this->getAccessibleMock(ConfigurationManager::class, ['getConfiguration'], [], '', false); - $mockedConfigurationManager->expects($this->any())->method('getConfiguration') + $mockedConfigurationManager->expects(self::any())->method('getConfiguration') ->withConsecutive([ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT], [ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS]) ->willReturnOnConsecutiveCalls( [ @@ -176,7 +175,7 @@ public function settingsAreProperlyInjected() 'key5' => '', ]; $subject->injectConfigurationManager($mockedConfigurationManager); - $this->assertEquals($expectedSettings, $subject->_get('settings')); + self::assertEquals($expectedSettings, $subject->_get('settings')); } /** @@ -187,7 +186,7 @@ public function demandIsCreated() $demand = new Demand(); $subject = $this->getAccessibleMock(AddressController::class, ['getPidList'], [], '', false); - $subject->expects($this->any())->method('getPidList')->willReturn(['123', '456']); + $subject->expects(self::any())->method('getPidList')->willReturn(['123', '456']); $subject->_set('settings', [ 'pages' => '123,456', 'singleRecords' => '7,4', @@ -202,7 +201,7 @@ public function demandIsCreated() $expected->setCategoryCombination('or'); $expected->setCategories('4,5,6'); - $this->assertEquals($expected, $subject->_call('createDemandFromSettings')); + self::assertEquals($expected, $subject->_call('createDemandFromSettings')); } /** @@ -217,7 +216,7 @@ public function showActionFillsView() 'contentObjectData' => [], ]; $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple'], [], '', false); - $mockedView->expects($this->once())->method('assignMultiple')->with($assigned); + $mockedView->expects(self::once())->method('assignMultiple')->with($assigned); $mockContentObject = $this->createMock(ContentObjectRenderer::class); $mockConfigurationManager = $this->createMock(ConfigurationManager::class); $mockConfigurationManager->method('getContentObject') @@ -226,7 +225,7 @@ public function showActionFillsView() $subject = $this->getAccessibleMock(AddressController::class, ['redirectToUri', 'htmlResponse'], [], '', false); $subject->_set('view', $mockedView); $subject->_set('configurationManager', $mockConfigurationManager); - $subject->expects($this->once())->method('htmlResponse'); + $subject->expects(self::once())->method('htmlResponse'); $subject->showAction($address); } @@ -244,16 +243,16 @@ public function listActionFillsViewForSingleRecords() $demand->setSingleRecords('134'); $mockedRepository = $this->getAccessibleMock(AddressRepository::class, ['getAddressesByCustomSorting'], [], '', false); - $mockedRepository->expects($this->once())->method('getAddressesByCustomSorting')->willReturn(['dummy return single']); + $mockedRepository->expects(self::once())->method('getAddressesByCustomSorting')->willReturn(['dummy return single']); $assignments = [ 'demand' => $demand, 'addresses' => ['dummy return single'], - 'contentObjectData' => [] + 'contentObjectData' => [], ]; $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); - $mockedView->expects($this->once())->method('assignMultiple')->with($assignments); + $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); $mockConfigurationManager = $this->createMock(ConfigurationManager::class); $mockContentObject = $this->createMock(ContentObjectRenderer::class); $mockConfigurationManager->method('getContentObject') @@ -261,8 +260,8 @@ public function listActionFillsViewForSingleRecords() $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument'], [], '', false); $subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false); - $subject->expects($this->once())->method('createDemandFromSettings')->willReturn($demand); - $subject->expects($this->once())->method('htmlResponse'); + $subject->expects(self::once())->method('createDemandFromSettings')->willReturn($demand); + $subject->expects(self::once())->method('htmlResponse'); $subject->_set('settings', $settings); $subject->_set('view', $mockedView); $subject->_set('request', $mockedRequest); @@ -285,7 +284,7 @@ public function listActionFillsViewForDemand() $demand->setPages(['12']); $mockedRepository = $this->getAccessibleMock(AddressRepository::class, ['findByDemand'], [], '', false); - $mockedRepository->expects($this->once())->method('findByDemand')->willReturn(['dummy return']); + $mockedRepository->expects(self::once())->method('findByDemand')->willReturn(['dummy return']); $mockContentObject = $this->createMock(ContentObjectRenderer::class); $mockConfigurationManager = $this->createMock(ConfigurationManager::class); $mockConfigurationManager->method('getContentObject') @@ -299,11 +298,11 @@ public function listActionFillsViewForDemand() $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument'], [], '', false); $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); - $mockedView->expects($this->once())->method('assignMultiple')->with($assignments); + $mockedView->expects(self::once())->method('assignMultiple')->with($assignments); $subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false); - $subject->expects($this->once())->method('createDemandFromSettings')->willReturn($demand); - $subject->expects($this->any())->method('htmlResponse'); + $subject->expects(self::once())->method('createDemandFromSettings')->willReturn($demand); + $subject->expects(self::any())->method('htmlResponse'); $subject->_set('settings', $settings); $subject->_set('view', $mockedView); $subject->_set('request', $mockedRequest); @@ -321,9 +320,9 @@ public function overrideDemandMethodIsCalledIfEnabled() { $mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument'], [], '', false); $mockedRepository = $this->getAccessibleMock(AddressRepository::class, ['getAddressesByCustomSorting', 'findByDemand'], [], '', false); - $mockedRepository->expects($this->any())->method('findByDemand')->willReturn([]); + $mockedRepository->expects(self::any())->method('findByDemand')->willReturn([]); $mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false); - $mockedView->expects($this->once())->method('assignMultiple'); + $mockedView->expects(self::once())->method('assignMultiple'); $mockContentObject = $this->createMock(ContentObjectRenderer::class); $mockConfigurationManager = $this->createMock(ConfigurationManager::class); $mockConfigurationManager->method('getContentObject') @@ -332,11 +331,11 @@ public function overrideDemandMethodIsCalledIfEnabled() $subject = $this->getAccessibleMock(AddressController::class, ['overrideDemand', 'createDemandFromSettings', 'htmlResponse'], [], '', false); $subject->_set('extensionConfiguration', $this->getMockedSettings()); $subject->_set('configurationManager', $mockConfigurationManager); - $subject->expects($this->any())->method('overrideDemand'); - $subject->expects($this->any())->method('htmlResponse'); + $subject->expects(self::any())->method('overrideDemand'); + $subject->expects(self::any())->method('htmlResponse'); $demand = new Demand(); - $subject->expects($this->any())->method('createDemandFromSettings')->willReturn($demand); + $subject->expects(self::any())->method('createDemandFromSettings')->willReturn($demand); $settings = [ 'allowOverride' => true, @@ -357,7 +356,7 @@ public function overrideDemandWorks(Demand $demandIn, Demand $demandOut, array $ { $subject = $this->getAccessibleMock(AddressController::class, null, [], '', false); - $this->assertEquals($demandOut, $subject->_call('overrideDemand', $demandIn, $override)); + self::assertEquals($demandOut, $subject->_call('overrideDemand', $demandIn, $override)); } public function overrideDemandWorksDataProvider(): array @@ -385,7 +384,7 @@ public function overrideDemandWorksDataProvider(): array protected function getMockedSettings() { $mockedSettings = $this->getAccessibleMock(Settings::class, ['getSettings'], [], '', false); - $mockedSettings->expects($this->any())->method('getSettings')->willReturn([]); + $mockedSettings->expects(self::any())->method('getSettings')->willReturn([]); return $mockedSettings; } diff --git a/Tests/Unit/Domain/Model/AddressTest.php b/Tests/Unit/Domain/Model/AddressTest.php index c75cc977..179c554a 100644 --- a/Tests/Unit/Domain/Model/AddressTest.php +++ b/Tests/Unit/Domain/Model/AddressTest.php @@ -1,9 +1,10 @@ subject->setGender($value); - $this->assertEquals($value, $this->subject->getGender()); + self::assertEquals($value, $this->subject->getGender()); } /** @@ -43,7 +44,7 @@ public function nameCanBeSet() { $value = 'Max Mustermann'; $this->subject->setName($value); - $this->assertEquals($value, $this->subject->getName()); + self::assertEquals($value, $this->subject->getName()); } /** @@ -53,7 +54,7 @@ public function firstNameCanBeSet() { $value = 'Max'; $this->subject->setFirstName($value); - $this->assertEquals($value, $this->subject->getFirstName()); + self::assertEquals($value, $this->subject->getFirstName()); } /** @@ -63,7 +64,7 @@ public function middleNameCanBeSet() { $value = 'J.'; $this->subject->setMiddleName($value); - $this->assertEquals($value, $this->subject->getMiddleName()); + self::assertEquals($value, $this->subject->getMiddleName()); } /** @@ -73,7 +74,7 @@ public function lastNameCanBeSet() { $value = 'Mustermann'; $this->subject->setLastName($value); - $this->assertEquals($value, $this->subject->getLastName()); + self::assertEquals($value, $this->subject->getLastName()); } /** @@ -83,7 +84,7 @@ public function birthdayCanBeSet() { $value = new \DateTime(); $this->subject->setBirthday($value); - $this->assertEquals($value, $this->subject->getBirthday()); + self::assertEquals($value, $this->subject->getBirthday()); } /** @@ -93,7 +94,7 @@ public function titleCanBeSet() { $value = 'dr.'; $this->subject->setTitle($value); - $this->assertEquals($value, $this->subject->getTitle()); + self::assertEquals($value, $this->subject->getTitle()); } /** @@ -103,7 +104,7 @@ public function addressCanBeSet() { $value = 'Dummystreet 134'; $this->subject->setAddress($value); - $this->assertEquals($value, $this->subject->getAddress()); + self::assertEquals($value, $this->subject->getAddress()); } /** @@ -113,7 +114,7 @@ public function latitudeCanBeSet() { $value = 123.121221; $this->subject->setLatitude($value); - $this->assertEquals($value, $this->subject->getLatitude()); + self::assertEquals($value, $this->subject->getLatitude()); } /** @@ -123,7 +124,7 @@ public function longitudeCanBeSet() { $value = 10.1291; $this->subject->setLongitude($value); - $this->assertEquals($value, $this->subject->getLongitude()); + self::assertEquals($value, $this->subject->getLongitude()); } /** @@ -133,7 +134,7 @@ public function buildingCanBeSet() { $value = 'building 1'; $this->subject->setBuilding($value); - $this->assertEquals($value, $this->subject->getBuilding()); + self::assertEquals($value, $this->subject->getBuilding()); } /** @@ -143,7 +144,7 @@ public function roomCanBeSet() { $value = 'room 1'; $this->subject->setRoom($value); - $this->assertEquals($value, $this->subject->getRoom()); + self::assertEquals($value, $this->subject->getRoom()); } public function telephoneFormatDataProvider() @@ -169,7 +170,7 @@ public function phoneCanBeSet() { $value = '+43129'; $this->subject->setPhone($value); - $this->assertEquals($value, $this->subject->getPhone()); + self::assertEquals($value, $this->subject->getPhone()); } /** @@ -193,7 +194,7 @@ public function faxCanBeSet() { $value = '+431294'; $this->subject->setFax($value); - $this->assertEquals($value, $this->subject->getFax()); + self::assertEquals($value, $this->subject->getFax()); } /** @@ -217,7 +218,7 @@ public function mobileCanBeSet() { $value = '+431294111'; $this->subject->setMobile($value); - $this->assertEquals($value, $this->subject->getMobile()); + self::assertEquals($value, $this->subject->getMobile()); } /** @@ -241,7 +242,7 @@ public function wwwCanBeSet() { $value = 'www.typo3.org'; $this->subject->setWww($value); - $this->assertEquals($value, $this->subject->getWww()); + self::assertEquals($value, $this->subject->getWww()); } /** @@ -251,7 +252,7 @@ public function wwwCanBeSet() public function simplifiedWwwIsReturned(string $given, string $expected) { $this->subject->setWww($given); - $this->assertEquals($expected, $this->subject->getWwwSimplified()); + self::assertEquals($expected, $this->subject->getWwwSimplified()); } public function simplifiedWwwIsReturnedDataProvider() @@ -272,7 +273,7 @@ public function slugCanBeSet() { $value = '/testaddress/'; $this->subject->setSlug($value); - $this->assertEquals($value, $this->subject->getSlug()); + self::assertEquals($value, $this->subject->getSlug()); } /** @@ -282,7 +283,7 @@ public function skypeCanBeSet() { $value = 'fo.com'; $this->subject->setSkype($value); - $this->assertEquals($value, $this->subject->getSkype()); + self::assertEquals($value, $this->subject->getSkype()); } /** @@ -292,7 +293,7 @@ public function twitterCanBeSet() { $value = '@georg_ringer'; $this->subject->setTwitter($value); - $this->assertEquals($value, $this->subject->getTwitter()); + self::assertEquals($value, $this->subject->getTwitter()); } /** @@ -304,7 +305,7 @@ public function wrongTwitterHandleThrowsErrorCanBeSet() $this->expectExceptionCode(1357530444); $value = 'georg_ringer'; $this->subject->setTwitter($value); - $this->assertEquals($value, $this->subject->getTwitter()); + self::assertEquals($value, $this->subject->getTwitter()); } /** @@ -314,7 +315,7 @@ public function facebookCanBeSet() { $value = '/fo'; $this->subject->setFacebook($value); - $this->assertEquals($value, $this->subject->getFacebook()); + self::assertEquals($value, $this->subject->getFacebook()); } /** @@ -326,7 +327,7 @@ public function wrongFacebookHandleThrowsErrorCanBeSet() $this->expectExceptionCode(1357530471); $value = 'some string'; $this->subject->setFacebook($value); - $this->assertEquals($value, $this->subject->getFacebook()); + self::assertEquals($value, $this->subject->getFacebook()); } /** @@ -336,7 +337,7 @@ public function linkedinCanBeSet() { $value = 'www.linkedin.com/bar'; $this->subject->setLinkedin($value); - $this->assertEquals($value, $this->subject->getLinkedin()); + self::assertEquals($value, $this->subject->getLinkedin()); } /** @@ -346,7 +347,7 @@ public function emailCanBeSet() { $value = 'some@example.org'; $this->subject->setEmail($value); - $this->assertEquals($value, $this->subject->getEmail()); + self::assertEquals($value, $this->subject->getEmail()); } /** @@ -356,7 +357,7 @@ public function companyCanBeSet() { $value = 'ACME'; $this->subject->setCompany($value); - $this->assertEquals($value, $this->subject->getCompany()); + self::assertEquals($value, $this->subject->getCompany()); } /** @@ -366,7 +367,7 @@ public function positionCanBeSet() { $value = 'Boss'; $this->subject->setPosition($value); - $this->assertEquals($value, $this->subject->getPosition()); + self::assertEquals($value, $this->subject->getPosition()); } /** @@ -376,7 +377,7 @@ public function cityCanBeSet() { $value = 'Linz'; $this->subject->setCity($value); - $this->assertEquals($value, $this->subject->getCity()); + self::assertEquals($value, $this->subject->getCity()); } /** @@ -386,7 +387,7 @@ public function zipCanBeSet() { $value = '30210'; $this->subject->setZip($value); - $this->assertEquals($value, $this->subject->getZip()); + self::assertEquals($value, $this->subject->getZip()); } /** @@ -396,7 +397,7 @@ public function regionCanBeSet() { $value = 'OOE'; $this->subject->setRegion($value); - $this->assertEquals($value, $this->subject->getRegion()); + self::assertEquals($value, $this->subject->getRegion()); } /** @@ -406,7 +407,7 @@ public function countryCanBeSet() { $value = 'AT'; $this->subject->setCountry($value); - $this->assertEquals($value, $this->subject->getCountry()); + self::assertEquals($value, $this->subject->getCountry()); } /** @@ -416,7 +417,7 @@ public function descriptionCanBeSet() { $value = 'lorem ipsum'; $this->subject->setDescription($value); - $this->assertEquals($value, $this->subject->getDescription()); + self::assertEquals($value, $this->subject->getDescription()); } /** @@ -430,7 +431,7 @@ public function imagesCanBeSet() $item->setPid(123); $value->attach($item); $this->subject->setImage($value); - $this->assertEquals($value, $this->subject->getImage()); + self::assertEquals($value, $this->subject->getImage()); } /** @@ -449,7 +450,7 @@ public function imagesCanBeAttached() $this->subject->setImage($value); $this->subject->addImage($item2); - $this->assertEquals(2, $this->subject->getImage()->count()); + self::assertEquals(2, $this->subject->getImage()->count()); } /** @@ -467,7 +468,7 @@ public function firstImageCanBeRetrieved() $item2->setPid(345); $this->subject->setImage($value); - $this->assertEquals($item, $this->subject->getFirstImage()); + self::assertEquals($item, $this->subject->getFirstImage()); } /** @@ -478,7 +479,7 @@ public function firstImageIsNullIfNoImages() $value = new ObjectStorage(); $this->subject->setImage($value); - $this->assertNull($this->subject->getFirstImage()); + self::assertNull($this->subject->getFirstImage()); } /** @@ -498,7 +499,7 @@ public function imagesCanBeRemoved() $this->subject->setImage($value); $this->subject->removeImage($item2); - $this->assertEquals(1, $this->subject->getImage()->count()); + self::assertEquals(1, $this->subject->getImage()->count()); } /** @@ -512,7 +513,7 @@ public function categoriesCanBeSet() $item->setPid(456); $value->attach($item); $this->subject->setCategories($value); - $this->assertEquals($value, $this->subject->getCategories()); + self::assertEquals($value, $this->subject->getCategories()); } /** @@ -526,7 +527,7 @@ public function fullNameIsReturned(string $expected, array $nameParts): void $this->subject->setLastName($nameParts[2]); $this->subject->setTitleSuffix($nameParts[3]); - $this->assertEquals($expected, $this->subject->getFullName()); + self::assertEquals($expected, $this->subject->getFullName()); } public function fullNameDataProvider(): array diff --git a/Tests/Unit/Domain/Model/Dto/DemandTest.php b/Tests/Unit/Domain/Model/Dto/DemandTest.php index dd40f9cb..3d74ff7b 100644 --- a/Tests/Unit/Domain/Model/Dto/DemandTest.php +++ b/Tests/Unit/Domain/Model/Dto/DemandTest.php @@ -1,9 +1,10 @@ subject = new Demand(); } @@ -29,7 +30,7 @@ public function pagesCanBeSet() { $value = ['123', '456']; $this->subject->setPages($value); - $this->assertEquals($value, $this->subject->getPages()); + self::assertEquals($value, $this->subject->getPages()); } /** @@ -39,7 +40,7 @@ public function sortByCanBeSet() { $value = 'title'; $this->subject->setSortBy($value); - $this->assertEquals($value, $this->subject->getSortBy()); + self::assertEquals($value, $this->subject->getSortBy()); } /** @@ -49,7 +50,7 @@ public function sortOrderCanBeSet() { $value = 'desc'; $this->subject->setSortOrder($value); - $this->assertEquals($value, $this->subject->getSortOrder()); + self::assertEquals($value, $this->subject->getSortOrder()); } /** @@ -59,7 +60,7 @@ public function categoriesCanBeSet() { $value = '12,34,5'; $this->subject->setCategories($value); - $this->assertEquals($value, $this->subject->getCategories()); + self::assertEquals($value, $this->subject->getCategories()); } /** @@ -69,7 +70,7 @@ public function categoryCombinationCanBeSet() { $value = 'AND'; $this->subject->setCategoryCombination($value); - $this->assertEquals($value, $this->subject->getCategoryCombination()); + self::assertEquals($value, $this->subject->getCategoryCombination()); } /** @@ -79,7 +80,7 @@ public function singleRecordsCanBeSet() { $value = '7,6,1'; $this->subject->setSingleRecords($value); - $this->assertEquals($value, $this->subject->getSingleRecords()); + self::assertEquals($value, $this->subject->getSingleRecords()); } /** @@ -89,7 +90,7 @@ public function includeSubCategoriesCanBeSet() { $value = true; $this->subject->setIncludeSubCategories($value); - $this->assertEquals($value, $this->subject->getIncludeSubCategories()); + self::assertEquals($value, $this->subject->getIncludeSubCategories()); } /** @@ -99,6 +100,6 @@ public function ignoreWithoutCoordinatesCanBeSet() { $value = true; $this->subject->setIgnoreWithoutCoordinates($value); - $this->assertEquals($value, $this->subject->getIgnoreWithoutCoordinates()); + self::assertEquals($value, $this->subject->getIgnoreWithoutCoordinates()); } } diff --git a/Tests/Unit/Domain/Model/Dto/SettingsTest.php b/Tests/Unit/Domain/Model/Dto/SettingsTest.php index 25578a48..65760df5 100644 --- a/Tests/Unit/Domain/Model/Dto/SettingsTest.php +++ b/Tests/Unit/Domain/Model/Dto/SettingsTest.php @@ -1,9 +1,10 @@ assertEquals('/[^\d\+\s\-]/', $subject->getTelephoneValidationPatternForPhp()); - $this->assertEquals('/[^\d\+\s\-]/g', $subject->getTelephoneValidationPatternForJs()); + self::assertEquals('/[^\d\+\s\-]/', $subject->getTelephoneValidationPatternForPhp()); + self::assertEquals('/[^\d\+\s\-]/g', $subject->getTelephoneValidationPatternForJs()); } /** @@ -50,7 +51,7 @@ public function settingsAreSet() ]; $subject = new Settings(); - $this->assertEquals('regex1', $subject->getTelephoneValidationPatternForPhp()); - $this->assertEquals('regex2', $subject->getTelephoneValidationPatternForJs()); + self::assertEquals('regex1', $subject->getTelephoneValidationPatternForPhp()); + self::assertEquals('regex2', $subject->getTelephoneValidationPatternForJs()); } } diff --git a/Tests/Unit/Evaluation/LatitudeEvaluationTest.php b/Tests/Unit/Evaluation/LatitudeEvaluationTest.php index a5bbb9be..34dab9da 100644 --- a/Tests/Unit/Evaluation/LatitudeEvaluationTest.php +++ b/Tests/Unit/Evaluation/LatitudeEvaluationTest.php @@ -1,9 +1,10 @@ markTestSkipped('Skipped as PageRenderer is called which leads into issues'); - $this->assertNotEmpty($this->subject->returnFieldJS()); + self::markTestSkipped('Skipped as PageRenderer is called which leads into issues'); + self::assertNotEmpty($this->subject->returnFieldJS()); } /** - * @param $given - * @param $expected * @test * @dataProvider latIsProperlyEvaluatedDataProvider */ public function latitudeIsProperlyEvaluated($given, $expected) { - $this->assertEquals($expected, $this->subject->evaluateFieldValue($given)); + self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } /** - * @param $given - * @param $expected * @test * @dataProvider latIsProperlyEvaluatedDataProvider */ public function latIsProperlyDeEvaluated($given, $expected) { $params = ['value' => $given]; - $this->assertEquals($expected, $this->subject->deevaluateFieldValue($params)); + self::assertEquals($expected, $this->subject->deevaluateFieldValue($params)); } public function latIsProperlyEvaluatedDataProvider(): array diff --git a/Tests/Unit/Evaluation/LongitudeEvaluationTest.php b/Tests/Unit/Evaluation/LongitudeEvaluationTest.php index ca7923e4..b92adf88 100644 --- a/Tests/Unit/Evaluation/LongitudeEvaluationTest.php +++ b/Tests/Unit/Evaluation/LongitudeEvaluationTest.php @@ -1,9 +1,10 @@ markTestSkipped('Skipped as PageRenderer is called which leads into issues'); - $this->assertNotEmpty($this->subject->returnFieldJS()); + self::markTestSkipped('Skipped as PageRenderer is called which leads into issues'); + self::assertNotEmpty($this->subject->returnFieldJS()); } /** - * @param $given - * @param $expected * @test * @dataProvider lngIsProperlyEvaluatedDataProvider */ public function longIsProperlyEvaluated($given, $expected) { - $this->assertEquals($expected, $this->subject->evaluateFieldValue($given)); + self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } /** - * @param $given - * @param $expected * @test * @dataProvider lngIsProperlyEvaluatedDataProvider */ public function lngIsProperlyDeEvaluated($given, $expected) { $params = ['value' => $given]; - $this->assertEquals($expected, $this->subject->deevaluateFieldValue($params)); + self::assertEquals($expected, $this->subject->deevaluateFieldValue($params)); } public function lngIsProperlyEvaluatedDataProvider(): array diff --git a/Tests/Unit/Evaluation/TelephoneEvaluationTest.php b/Tests/Unit/Evaluation/TelephoneEvaluationTest.php index bdc96793..6d6f9eeb 100644 --- a/Tests/Unit/Evaluation/TelephoneEvaluationTest.php +++ b/Tests/Unit/Evaluation/TelephoneEvaluationTest.php @@ -1,9 +1,10 @@ getAccessibleMock(TelephoneEvaluation::class, null, [], '', true); $settings = new Settings(); - $this->assertEquals($settings, $subject->_get('extensionSettings')); + self::assertEquals($settings, $subject->_get('extensionSettings')); } /** @@ -47,31 +48,27 @@ public function constructorIsCalled() */ public function jsEvaluationIsCalled() { - $this->markTestSkipped('Skipped as PageRenderer is called which leads into issues'); - $this->assertNotEmpty($this->subject->returnFieldJS()); + self::markTestSkipped('Skipped as PageRenderer is called which leads into issues'); + self::assertNotEmpty($this->subject->returnFieldJS()); } /** - * @param $given - * @param $expected * @test * @dataProvider telephoneIsProperlyEvaluatedDataProvider */ public function telephoneIsProperlyEvaluated($given, $expected) { - $this->assertEquals($expected, $this->subject->evaluateFieldValue($given)); + self::assertEquals($expected, $this->subject->evaluateFieldValue($given)); } /** - * @param $given - * @param $expected * @test * @dataProvider telephoneIsProperlyEvaluatedDataProvider */ public function telephoneIsProperlyDeEvaluated($given, $expected) { $params = ['value' => $given]; - $this->assertEquals($expected, $this->subject->deevaluateFieldValue($params)); + self::assertEquals($expected, $this->subject->deevaluateFieldValue($params)); } public function telephoneIsProperlyEvaluatedDataProvider(): array diff --git a/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php b/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php index d6a3b609..76349799 100755 --- a/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php +++ b/Tests/Unit/Hooks/Tca/AddFieldsToSelectorTest.php @@ -1,9 +1,10 @@ getAccessibleMock(AddFieldsToSelector::class, null, [], '', true); - $this->assertEquals($languageService, $subject->_get('languageService')); + self::assertEquals($languageService, $subject->_get('languageService')); } /** @@ -37,11 +38,11 @@ public function optionsAreFilled() } $mockedLanguageService = $this->getAccessibleMock(LanguageService::class, ['sL'], [], '', false); - $mockedLanguageService->expects($this->any()) + $mockedLanguageService->expects(self::any()) ->method('sL') - ->will($this->returnCallback(function ($o) { + ->willReturnCallback(function ($o) { return $o; - })); + }); $subject = $this->getAccessibleMock(AddFieldsToSelector::class, null, [], '', false); $subject->_set('languageService', $mockedLanguageService); @@ -71,9 +72,9 @@ public function optionsAreFilled() ['label_www', 'www'], ['label_zip', 'zip'], ['LLL:EXT:tt_address/Resources/Private/Language/ff/locallang_ff.xlf:pi1_flexform.sortBy.singleSelection', 'singleSelection'], - ] + ], ]; - $this->assertEquals($expected, $items); + self::assertEquals($expected, $items); } } diff --git a/Tests/Unit/Seo/AddressTitleProviderTest.php b/Tests/Unit/Seo/AddressTitleProviderTest.php index a7e3e452..bc093110 100755 --- a/Tests/Unit/Seo/AddressTitleProviderTest.php +++ b/Tests/Unit/Seo/AddressTitleProviderTest.php @@ -1,9 +1,10 @@ getAccessibleMock(AddressTitleProvider::class, null, [], '', false); $mockedProvider->setTitle($address, $configuration); - $this->assertEquals($expected, $mockedProvider->getTitle()); + self::assertEquals($expected, $mockedProvider->getTitle()); } public function addressTitleProvider(): array @@ -44,36 +43,36 @@ public function addressTitleProvider(): array [ 'firstName' => 'Max', 'middleName' => '', - 'lastName' => 'Mustermann' + 'lastName' => 'Mustermann', ], [ - 'properties' => 'firstName,middleName,lastName' - ] + 'properties' => 'firstName,middleName,lastName', + ], ], 'custom clue' => [ 'Max - M. - Mustermann', [ 'firstName' => 'Max', 'middleName' => 'M.', - 'lastName' => 'Mustermann' + 'lastName' => 'Mustermann', ], [ 'properties' => 'firstName,middleName,lastName', - 'glue' => '" - "' - ] + 'glue' => '" - "', + ], ], 'empty custom clue' => [ 'Max M. Mustermann', [ 'firstName' => 'Max', 'middleName' => 'M.', - 'lastName' => 'Mustermann' + 'lastName' => 'Mustermann', ], [ 'properties' => 'firstName,middleName,lastName', - 'glue' => '' - ] - ] + 'glue' => '', + ], + ], ]; } } diff --git a/Tests/Unit/Service/GeocodeServiceTest.php b/Tests/Unit/Service/GeocodeServiceTest.php index bc3447ca..b0ca17f5 100644 --- a/Tests/Unit/Service/GeocodeServiceTest.php +++ b/Tests/Unit/Service/GeocodeServiceTest.php @@ -1,4 +1,5 @@ getAccessibleMock(GeocodeService::class, null, [], '', false); $apiResponse = $subject->_call('getApiCallResult', 'http://dummy.com'); - $this->assertEquals($content, $apiResponse); + self::assertEquals($content, $apiResponse); } /** @@ -53,7 +54,7 @@ public function invalidAPiResultReturnsEmptyArray() $subject = $this->getAccessibleMock(GeocodeService::class, null, [], '', false); $apiResponse = $subject->_call('getApiCallResult', 'http://dummy.com'); - $this->assertEquals([], $apiResponse); + self::assertEquals([], $apiResponse); } /** diff --git a/Tests/Unit/Utility/CacheUtilityTest.php b/Tests/Unit/Utility/CacheUtilityTest.php index 677ab533..f2dacef2 100644 --- a/Tests/Unit/Utility/CacheUtilityTest.php +++ b/Tests/Unit/Utility/CacheUtilityTest.php @@ -1,9 +1,10 @@ getAccessibleMock( TypoScriptFrontendController::class, @@ -34,7 +35,7 @@ public function nonArrayRecordInstancesAreSkippedForCacheTags() { $addressRecords = ['dummy string']; - $GLOBALS['TSFE']->expects($this->once())->method('addCacheTags')->with([]); + $GLOBALS['TSFE']->expects(self::once())->method('addCacheTags')->with([]); CacheUtility::addCacheTagsByAddressRecords($addressRecords); } @@ -49,7 +50,7 @@ public function addressRecordWithLocalizedIdAddsCacheTags() $addressRecord->_setProperty('_localizedUid', 43); $addressRecords = [$addressRecord]; - $GLOBALS['TSFE']->expects($this->once())->method('addCacheTags')->with(['tt_address_42', 'tt_address_43']); + $GLOBALS['TSFE']->expects(self::once())->method('addCacheTags')->with(['tt_address_42', 'tt_address_43']); CacheUtility::addCacheTagsByAddressRecords($addressRecords); } diff --git a/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php b/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php index 376fa24d..5f39c8f2 100644 --- a/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php +++ b/Tests/Unit/Utility/EvalcoordinatesUtilityTest.php @@ -1,9 +1,10 @@ assertEquals($expected, EvalcoordinatesUtility::formatLongitude($given)); + self::assertEquals($expected, EvalcoordinatesUtility::formatLongitude($given)); } public function longIsProperlyEvaluatedDataProvider(): array @@ -38,14 +37,12 @@ public function longIsProperlyEvaluatedDataProvider(): array } /** - * @param $given - * @param $expected * @test * @dataProvider latIsProperlyEvaluatedDataProvider */ public function latIsProperlyEvaluated($given, $expected) { - $this->assertEquals($expected, EvalcoordinatesUtility::formatLatitude($given)); + self::assertEquals($expected, EvalcoordinatesUtility::formatLatitude($given)); } public function latIsProperlyEvaluatedDataProvider(): array diff --git a/Tests/Unit/Utility/TypoScriptTest.php b/Tests/Unit/Utility/TypoScriptTest.php index ef2195d8..a8477027 100644 --- a/Tests/Unit/Utility/TypoScriptTest.php +++ b/Tests/Unit/Utility/TypoScriptTest.php @@ -1,9 +1,10 @@ [ 'sub' => 'value sub', 'sub_array' => [ - 'sub_sub' => 'sub_sub_value' - ] + 'sub_sub' => 'sub_sub_value', + ], ], 'override_empty' => '', 'override_int' => '0', @@ -35,7 +36,7 @@ public function tsIsOverloadedCorrectly() 'override_sub' => [ 'sub_empty' => '', 'sub_full' => 'sub_value', - 'sub_standalone' => 'standalone' + 'sub_standalone' => 'standalone', ], ]; @@ -48,17 +49,17 @@ public function tsIsOverloadedCorrectly() 'override_sub' => [ 'sub_empty' => 'some_value', 'sub_full' => 'sub_value_2', - 'sub_standalone_2' => 'standalone' - ] - ] + 'sub_standalone_2' => 'standalone', + ], + ], ]; $expected = [ 'default1' => 'value', 'default_as_array' => [ 'sub' => 'value sub', 'sub_array' => [ - 'sub_sub' => 'sub_sub_value' - ] + 'sub_sub' => 'sub_sub_value', + ], ], 'override_empty' => 'a_value', 'override_not_empty' => 'content_already_here', @@ -66,10 +67,10 @@ public function tsIsOverloadedCorrectly() 'override_sub' => [ 'sub_empty' => 'some_value', 'sub_full' => 'sub_value', - 'sub_standalone' => 'standalone' - ] + 'sub_standalone' => 'standalone', + ], ]; - $this->assertEquals($expected, $subject->override($flexforms, $tsData)); + self::assertEquals($expected, $subject->override($flexforms, $tsData)); } } diff --git a/Tests/Unit/ViewHelpers/RemoveSpacesViewHelperTest.php b/Tests/Unit/ViewHelpers/RemoveSpacesViewHelperTest.php index 61c2b003..de65737b 100644 --- a/Tests/Unit/ViewHelpers/RemoveSpacesViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/RemoveSpacesViewHelperTest.php @@ -1,9 +1,10 @@ viewHelper->renderStatic( ['value' => ' +43 123 56 34 34 '], - function () { - }, + function () {}, $this->prophesize(RenderingContextInterface::class)->reveal() ); - $this->assertEquals('+43123563434', $actualResult); + self::assertEquals('+43123563434', $actualResult); } } diff --git a/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php b/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php index 9009d9ad..6ea8e53c 100644 --- a/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/StaticGoogleMapsViewHelperTest.php @@ -1,9 +1,10 @@ viewHelper = new StaticGoogleMapsViewHelper(); @@ -40,12 +39,11 @@ public function staticGoogleMapsViewHelpersIsCalled(array $parameters, $result) { $actualResult = $this->viewHelper->renderStatic( $parameters, - function () { - }, + function () {}, $this->prophesize(RenderingContextInterface::class)->reveal() ); - $this->assertEquals($result, $actualResult); + self::assertEquals($result, $actualResult); } public function staticGoogleMapsViewHelpersIsCalledDataProvider(): array @@ -72,9 +70,9 @@ public function staticGoogleMapsViewHelpersIsCalledDataProvider(): array 'key' => 'abcdefgh', 'size' => '300x400', ], - 'addresses' => $addresses1 + 'addresses' => $addresses1, ], - 'https://maps.googleapis.com/maps/api/staticmap?&key=abcdefgh&size=300x400&zoom=13&markers=1.1,1.2' + 'https://maps.googleapis.com/maps/api/staticmap?&key=abcdefgh&size=300x400&zoom=13&markers=1.1,1.2', ], '2 addresses' => [ [ @@ -82,10 +80,10 @@ public function staticGoogleMapsViewHelpersIsCalledDataProvider(): array 'key' => 'abcdefgh', 'size' => '300x400', ], - 'addresses' => $addresses2 + 'addresses' => $addresses2, ], - 'https://maps.googleapis.com/maps/api/staticmap?&key=abcdefgh&size=300x400&markers=1.1,1.2&markers=2.1,2.2' - ] + 'https://maps.googleapis.com/maps/api/staticmap?&key=abcdefgh&size=300x400&markers=1.1,1.2&markers=2.1,2.2', + ], ]; } } diff --git a/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php b/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php index c711ea1f..478b341a 100755 --- a/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php +++ b/Tests/UnitDeprecated/FormEngine/FieldControl/LocationMapWizardTest.php @@ -1,9 +1,10 @@ getAccessibleMock(LocationMapWizard::class, null, [], '', false); - $this->assertEquals($languageService, $subject->_call('getLanguageService')); + self::assertEquals($languageService, $subject->_call('getLanguageService')); } /** @@ -34,10 +35,10 @@ public function languageServiceIsReturned() public function properResultArrayIsReturned() { $languageService = $this->getAccessibleMock(LanguageService::class, ['sL'], [], '', false); - $languageService->expects($this->any())->method('sL')->willReturn('label'); + $languageService->expects(self::any())->method('sL')->willReturn('label'); $subject = $this->getAccessibleMock(LocationMapWizard::class, ['getLanguageService'], [], '', false); - $subject->expects($this->any())->method('getLanguageService')->willReturn($languageService); + $subject->expects(self::any())->method('getLanguageService')->willReturn($languageService); $data = [ 'databaseRow' => [ @@ -51,6 +52,6 @@ public function properResultArrayIsReturned() $subject->_set('data', $data); $result = $subject->render(); - $this->assertEquals('location-map-wizard', $result['iconIdentifier']); + self::assertEquals('location-map-wizard', $result['iconIdentifier']); } } diff --git a/composer.json b/composer.json index 29ee4f10..f05a98ef 100755 --- a/composer.json +++ b/composer.json @@ -46,12 +46,13 @@ "typo3-ter/tt-address": "self.version" }, "require-dev": { - "typo3/cms-install": "^12 || ^13", - "sbuerk/typo3-cmscomposerinstallers-testingframework-bridge": "^0.0.1", - "typo3/cms-extensionmanager": "^12 || ^13", - "phpunit/phpunit": "^9.6.15", - "php-coveralls/php-coveralls": "^2.1", - "phpspec/prophecy-phpunit": "^2.0" + "typo3/cms-composer-installers": "^3.1.3 || 4.0.0-RC1 || ^5.0", + "typo3/testing-framework": "^7.0.1", + "phpunit/phpunit": "^9", + "typo3/coding-standards": "^0.5.3", + "friendsofphp/php-cs-fixer": "^3", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.21", + "webmozart/assert": "^1.11.0" }, "config": { "vendor-dir": ".Build/vendor", @@ -63,6 +64,8 @@ } }, "scripts": { + "cs": "php ./.Build/bin/php-cs-fixer fix --dry-run -v --config ./Build/php-cs-fixer/php-cs-fixer.php ./", + "csfix": "php ./.Build/bin/php-cs-fixer fix -v --config ./Build/php-cs-fixer/php-cs-fixer.php ./", "post-autoload-dump": [ "TYPO3\\TestingFramework\\Composer\\ExtensionTestEnvironment::prepare" ] diff --git a/ext_emconf.php b/ext_emconf.php index 510c6bc2..8ba6bedb 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,10 +19,9 @@ ], ], 'autoload' => [ - 'psr-4' => ['FriendsOfTYPO3\\TtAddress\\' => 'Classes'] + 'psr-4' => ['FriendsOfTYPO3\\TtAddress\\' => 'Classes'], + ], + 'autoload-dev' => [ + 'psr-4' => ['FriendsOfTYPO3\\TtAddress\\Tests\\' => 'Tests'], ], - 'autoload-dev' => - [ - 'psr-4' => ['FriendsOfTYPO3\\TtAddress\\Tests\\' => 'Tests'] - ], ]; diff --git a/ext_localconf.php b/ext_localconf.php index bac8eb37..8a963116 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,4 +1,5 @@ \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, - 'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, + 'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, ]; } @@ -19,9 +20,9 @@ =========================================================================== */ // Add wizard with map for setting geo location $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1546531781] = [ - 'nodeName' => 'locationMapWizard', - 'priority' => 30, - 'class' => \FriendsOfTYPO3\TtAddress\FormEngine\FieldControl\LocationMapWizard::class + 'nodeName' => 'locationMapWizard', + 'priority' => 30, + 'class' => \FriendsOfTYPO3\TtAddress\FormEngine\FieldControl\LocationMapWizard::class, ]; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); @@ -30,7 +31,7 @@ 'TtAddress', 'ListView', [ - \FriendsOfTYPO3\TtAddress\Controller\AddressController::class => 'list,show' + \FriendsOfTYPO3\TtAddress\Controller\AddressController::class => 'list,show', ] ); diff --git a/ext_tables.php b/ext_tables.php index 2af85d6e..a6b1dc93 100755 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,4 +1,5 @@