From bd503834d77a3a00c8850d8a83a187ca889692a8 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Fri, 29 Apr 2022 01:47:02 +0200 Subject: [PATCH 1/4] 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 -- 2.45.2 From 2162238cc653af9df5bbfe0cdad90ee8c56c8105 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Fri, 29 Apr 2022 03:01:27 +0200 Subject: [PATCH 2/4] 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 @@ Date: Sat, 30 Apr 2022 15:16:28 +0200 Subject: [PATCH 3/4] Basing functional test build on base distribution --- .woodpecker/Build/composer.json | 29 ----------------------------- .woodpecker/test.yml | 29 ++++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 34 deletions(-) delete mode 100644 .woodpecker/Build/composer.json diff --git a/.woodpecker/Build/composer.json b/.woodpecker/Build/composer.json deleted file mode 100644 index 5d1f074..0000000 --- a/.woodpecker/Build/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "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/test.yml b/.woodpecker/test.yml index 8861184..1e7f30e 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -1,7 +1,26 @@ +workspace: + base: /woodpecker + path: package + +matrix: + NEOS_VERSION: + # - 4.3 not possible, because 4.3 does not run work with composer 2 - we had to install an older version of composer, too + - 5.3 + pipeline: - build: - image: composer + functional-tests: + image: thecodingmachine/php:7.4-v4-cli + environment: + # Enable the PDO_SQLITE extension + - "PHP_EXTENSION_PDO_SQLITE=1" + - "NEOS_VERSION=${NEOS_VERSION}" + - "NEOS_BUILD_DIR=/woodpecker/Build-$NEOS_VERSION" commands: - - cd .woodpecker/Build - - composer install - - bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.SettingValidator/Tests/Functional + - "sudo mkdir $NEOS_BUILD_DIR" + - "sudo chown -R docker:docker $NEOS_BUILD_DIR" + - "cd $NEOS_BUILD_DIR" + - "composer create-project --no-install neos/flow-base-distribution:^$NEOS_VERSION ." + - "composer config repositories.repo-name path /woodpecker/package" + - "composer remove --dev neos/behat" + - "composer require digicomp/settingvalidator:@dev" + - "bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.SettingValidator/Tests/Functional" -- 2.45.2 From 1d09aeecedf3593f3d964306d682f45857c967a8 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sat, 30 Apr 2022 18:16:17 +0200 Subject: [PATCH 4/4] Adding Flow 4.3 build --- .woodpecker/test.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 1e7f30e..cdf520b 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -3,8 +3,8 @@ workspace: path: package matrix: - NEOS_VERSION: - # - 4.3 not possible, because 4.3 does not run work with composer 2 - we had to install an older version of composer, too + FLOW_VERSION: + - 4.3 - 5.3 pipeline: @@ -13,14 +13,34 @@ pipeline: environment: # Enable the PDO_SQLITE extension - "PHP_EXTENSION_PDO_SQLITE=1" - - "NEOS_VERSION=${NEOS_VERSION}" - - "NEOS_BUILD_DIR=/woodpecker/Build-$NEOS_VERSION" + - "FLOW_VERSION=${FLOW_VERSION}" + - "NEOS_BUILD_DIR=/woodpecker/Build-${FLOW_VERSION}" commands: - "sudo mkdir $NEOS_BUILD_DIR" - "sudo chown -R docker:docker $NEOS_BUILD_DIR" - "cd $NEOS_BUILD_DIR" - - "composer create-project --no-install neos/flow-base-distribution:^$NEOS_VERSION ." + - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then sudo composer self-update --1; fi" + - "composer create-project --no-install neos/flow-base-distribution:^$FLOW_VERSION ." - "composer config repositories.repo-name path /woodpecker/package" - "composer remove --dev neos/behat" + - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then composer require typo3fluid/fluid:2.4.3; fi" - "composer require digicomp/settingvalidator:@dev" + - | + if [ "$FLOW_VERSION" = "4.3" ]; then + echo 'Neos: + Flow: + persistence: + backendOptions: + dbname: "flow_functional_testing" + error: + errorHandler: + exceptionalErrors: + 0: "%E_USER_ERROR%" + 1: "%E_RECOVERABLE_ERROR%" + 2: ~ + 3: "%E_NOTICE%" + 4: "%E_USER_WARNING%" + 5: "%E_USER_NOTICE%" + 6: "%E_STRICT%"' > Configuration/Testing/Settings.yaml + fi - "bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.SettingValidator/Tests/Functional" -- 2.45.2