From 86cf0c546bf37cb15eb77a8d2398314fe247557c Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Thu, 28 Apr 2022 22:49:56 +0200 Subject: [PATCH 1/3] adding code-style pipeline --- .woodpecker/code-style.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .woodpecker/code-style.yml diff --git a/.woodpecker/code-style.yml b/.woodpecker/code-style.yml new file mode 100644 index 0000000..8124b8f --- /dev/null +++ b/.woodpecker/code-style.yml @@ -0,0 +1,7 @@ +pipeline: + code-style: + image: composer + commands: + - composer global config repositories.repo-name vcs https://git.digital-competence.de/Packages/php-codesniffer + - composer global require digicomp/php-codesniffer:@dev + - composer global exec -- phpcs --standard=DigiComp . From bd503834d77a3a00c8850d8a83a187ca889692a8 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Fri, 29 Apr 2022 01:47:02 +0200 Subject: [PATCH 2/3] adding functional test --- .woodpecker/Build/composer.json | 29 +++++++++++++++++++++++++++++ .woodpecker/code-style.yml | 2 +- .woodpecker/test.yml | 7 +++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .woodpecker/Build/composer.json create mode 100644 .woodpecker/test.yml diff --git a/.woodpecker/Build/composer.json b/.woodpecker/Build/composer.json new file mode 100644 index 0000000..5d1f074 --- /dev/null +++ b/.woodpecker/Build/composer.json @@ -0,0 +1,29 @@ +{ + "name": "digicomp/settingvalidator-distribution", + "description": "SettingValidator Distribution", + "config": { + "vendor-dir": "Packages/Libraries", + "bin-dir": "bin", + "platform": { + "php": "7.4.0" + } + }, + "require": { + "digicomp/settingvalidator": "*@dev", + "php": "~7.4.0" + }, + "require-dev": { + "neos/buildessentials": "^5.3", + "phpunit/phpunit": "~8.1", + "mikey179/vfsstream": "~1.6" + }, + "repositories": [ + { "type": "path", "url": "../../../src" } + ], + "scripts": { + "post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall", + "post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall", + "post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall", + "post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall" + } +} diff --git a/.woodpecker/code-style.yml b/.woodpecker/code-style.yml index 8124b8f..453df4b 100644 --- a/.woodpecker/code-style.yml +++ b/.woodpecker/code-style.yml @@ -4,4 +4,4 @@ pipeline: commands: - composer global config repositories.repo-name vcs https://git.digital-competence.de/Packages/php-codesniffer - composer global require digicomp/php-codesniffer:@dev - - composer global exec -- phpcs --standard=DigiComp . + - composer global exec -- phpcs --runtime-set ignore_warnings_on_exit 1 --standard=DigiComp Classes/ Migrations/ Tests/ Resources/Private/ diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..8861184 --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,7 @@ +pipeline: + build: + image: composer + commands: + - cd .woodpecker/Build + - composer install + - bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.SettingValidator/Tests/Functional From 2162238cc653af9df5bbfe0cdad90ee8c56c8105 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Fri, 29 Apr 2022 03:01:27 +0200 Subject: [PATCH 3/3] Only code-style --- .../Validation/Validator/SettingsValidator.php | 17 ++++++++++------- Migrations/Code/Version20170603120900.php | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Classes/Validation/Validator/SettingsValidator.php b/Classes/Validation/Validator/SettingsValidator.php index 5e005ef..ea3f6a4 100644 --- a/Classes/Validation/Validator/SettingsValidator.php +++ b/Classes/Validation/Validator/SettingsValidator.php @@ -28,8 +28,8 @@ use Neos\Utility\TypeHandling; class SettingsValidator extends AbstractValidator { /** - * @var ValidatorResolver * @Flow\Inject + * @var ValidatorResolver */ protected $validatorResolver; @@ -39,9 +39,9 @@ class SettingsValidator extends AbstractValidator protected $configurationManager; /** - * @var ReflectionService * @Flow\Inject * @deprecated + * @var ReflectionService */ protected $reflectionService; @@ -54,7 +54,7 @@ class SettingsValidator extends AbstractValidator ['Default'], 'Same as "Validation Groups" of Flow Framework. Defines the groups to execute.', 'array', - false + false, ], ]; @@ -107,7 +107,7 @@ class SettingsValidator extends AbstractValidator if (! $validator) { throw new InvalidValidationConfigurationException( - sprintf( + \sprintf( 'Validator could not be resolved: "%s" Check your Validation.yaml', $validatorConfig['validator'] ), @@ -135,7 +135,7 @@ class SettingsValidator extends AbstractValidator $config = []; if (isset($this->validations[$name]['self'])) { foreach ($this->validations[$name]['self'] as $validator => &$validation) { - if (is_null($validation)) { + if ($validation === null) { continue; } $newValidation['options'] = $validation; @@ -146,7 +146,7 @@ class SettingsValidator extends AbstractValidator if (isset($this->validations[$name]['properties'])) { foreach ($this->validations[$name]['properties'] as $propertyName => &$validation) { foreach ($validation as $validator => &$options) { - if (is_null($options)) { + if ($options === null) { continue; } $newValidation['property'] = $propertyName; @@ -168,7 +168,10 @@ class SettingsValidator extends AbstractValidator */ protected function doesValidationGroupsMatch(array &$validatorConfig) { - if (isset($validatorConfig['options']['validationGroups']) && empty(array_intersect($validatorConfig['options']['validationGroups'], $this->options['validationGroups']))) { + if ( + isset($validatorConfig['options']['validationGroups']) + && \array_intersect($validatorConfig['options']['validationGroups'], $this->options['validationGroups']) === [] + ) { return false; } diff --git a/Migrations/Code/Version20170603120900.php b/Migrations/Code/Version20170603120900.php index 33318b6..1ac9f1e 100644 --- a/Migrations/Code/Version20170603120900.php +++ b/Migrations/Code/Version20170603120900.php @@ -1,4 +1,5 @@