Merge branch 'feature/flow_6.x' into develop
This commit is contained in:
commit
3426886a56
11 changed files with 134 additions and 149 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
.svn
|
|
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Changelog
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## 3.0.0 - 2020-08-31
|
||||||
|
|
||||||
|
Start of the changelog.
|
|
@ -14,19 +14,17 @@ namespace DigiComp\SettingValidator;
|
||||||
|
|
||||||
use Neos\Flow\Configuration\ConfigurationManager;
|
use Neos\Flow\Configuration\ConfigurationManager;
|
||||||
use Neos\Flow\Core\Bootstrap;
|
use Neos\Flow\Core\Bootstrap;
|
||||||
use Neos\Flow\Package\Package as BasePackage;
|
use Neos\Flow\Package\Package as NeosFlowPackagePackage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Package base class of the DigiComp.SettingValidator package.
|
* Package base class of the DigiComp.SettingValidator package.
|
||||||
*/
|
*/
|
||||||
class Package extends BasePackage
|
class Package extends NeosFlowPackagePackage
|
||||||
{
|
{
|
||||||
const CONFIGURATION_TYPE_VALIDATION = 'Validation';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bootstrap $bootstrap
|
* @param Bootstrap $bootstrap
|
||||||
*/
|
*/
|
||||||
public function boot(Bootstrap $bootstrap)
|
public function boot(Bootstrap $bootstrap): void
|
||||||
{
|
{
|
||||||
parent::boot($bootstrap);
|
parent::boot($bootstrap);
|
||||||
|
|
||||||
|
@ -35,11 +33,7 @@ class Package extends BasePackage
|
||||||
ConfigurationManager::class,
|
ConfigurationManager::class,
|
||||||
'configurationManagerReady',
|
'configurationManagerReady',
|
||||||
function (ConfigurationManager $configurationManager) {
|
function (ConfigurationManager $configurationManager) {
|
||||||
$configurationManager->registerConfigurationType(
|
$configurationManager->registerConfigurationType('Validation');
|
||||||
static::CONFIGURATION_TYPE_VALIDATION,
|
|
||||||
ConfigurationManager::CONFIGURATION_PROCESSING_TYPE_DEFAULT,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,9 @@ namespace DigiComp\SettingValidator\Validation\Validator;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Neos\Flow\Annotations as Flow;
|
use Neos\Flow\Annotations as Flow;
|
||||||
use Neos\Flow\Configuration\ConfigurationManager;
|
|
||||||
use Neos\Flow\Reflection\ReflectionService;
|
|
||||||
use Neos\Flow\Validation\Exception\InvalidValidationConfigurationException;
|
use Neos\Flow\Validation\Exception\InvalidValidationConfigurationException;
|
||||||
use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
|
use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
|
||||||
|
use Neos\Flow\Validation\Exception\NoSuchValidatorException;
|
||||||
use Neos\Flow\Validation\Validator\AbstractValidator;
|
use Neos\Flow\Validation\Validator\AbstractValidator;
|
||||||
use Neos\Flow\Validation\ValidatorResolver;
|
use Neos\Flow\Validation\ValidatorResolver;
|
||||||
use Neos\Utility\ObjectAccess;
|
use Neos\Utility\ObjectAccess;
|
||||||
|
@ -28,72 +27,45 @@ use Neos\Utility\TypeHandling;
|
||||||
class SettingsValidator extends AbstractValidator
|
class SettingsValidator extends AbstractValidator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ValidatorResolver
|
|
||||||
* @Flow\Inject
|
* @Flow\Inject
|
||||||
|
* @var ValidatorResolver
|
||||||
*/
|
*/
|
||||||
protected $validatorResolver;
|
protected $validatorResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ConfigurationManager
|
* @Flow\InjectConfiguration(type="Validation")
|
||||||
*/
|
|
||||||
protected $configurationManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ReflectionService
|
|
||||||
* @Flow\Inject
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
protected $reflectionService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
protected array $validations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
protected $supportedOptions = [
|
protected $supportedOptions = [
|
||||||
'name' => ['', 'Set the name of the setting-array to use', 'string', false],
|
'name' => ['', 'Name of the setting array to use', 'string'],
|
||||||
'validationGroups' => [
|
'validationGroups' => [['Default'], 'Same as "Validation Groups" of Flow Framework', 'array'],
|
||||||
['Default'],
|
|
||||||
'Same as "Validation Groups" of Flow Framework. Defines the groups to execute.',
|
|
||||||
'array',
|
|
||||||
false
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @inheritDoc
|
||||||
*/
|
|
||||||
protected $validations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ConfigurationManager $configurationManager
|
|
||||||
*/
|
|
||||||
public function injectConfigurationManager(ConfigurationManager $configurationManager)
|
|
||||||
{
|
|
||||||
$this->configurationManager = $configurationManager;
|
|
||||||
$this->validations = $this->configurationManager->getConfiguration('Validation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if $value is valid. If it is not valid, needs to add an error
|
|
||||||
* to Result.
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* @throws InvalidValidationOptionsException
|
* @throws InvalidValidationOptionsException
|
||||||
* @throws InvalidValidationConfigurationException
|
* @throws InvalidValidationConfigurationException
|
||||||
|
* @throws NoSuchValidatorException
|
||||||
*/
|
*/
|
||||||
protected function isValid($value)
|
protected function isValid($value): void
|
||||||
{
|
{
|
||||||
$name = $this->options['name'] ? $this->options['name'] : TypeHandling::getTypeForValue($value);
|
$validations = $this->validations;
|
||||||
if (! isset($this->validations[$name])) {
|
|
||||||
|
$name = $this->options['name'] !== '' ? $this->options['name'] : TypeHandling::getTypeForValue($value);
|
||||||
|
if (!isset($validations[$name])) {
|
||||||
throw new InvalidValidationOptionsException(
|
throw new InvalidValidationOptionsException(
|
||||||
'The name ' . $name . ' has not been defined in Validation.yaml!',
|
'The name "' . $name . '" has not been defined in Validation.yaml!',
|
||||||
1397821438
|
1397821438
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->getConfigForName($name);
|
foreach ($this->getConfigForValidation($validations[$name]) as $validatorConfig) {
|
||||||
|
if (!$this->doesValidationGroupsMatch($validatorConfig)) {
|
||||||
foreach ($config as $validatorConfig) {
|
|
||||||
if (! $this->doesValidationGroupsMatch($validatorConfig)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +76,10 @@ class SettingsValidator extends AbstractValidator
|
||||||
$validatorConfig['options']
|
$validatorConfig['options']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! $validator) {
|
if ($validator === null) {
|
||||||
throw new InvalidValidationConfigurationException(
|
throw new InvalidValidationConfigurationException(
|
||||||
sprintf(
|
\sprintf(
|
||||||
'Validator could not be resolved: "%s" Check your Validation.yaml',
|
'Validator "%s" could not be resolved. Check your Validation.yaml',
|
||||||
$validatorConfig['validator']
|
$validatorConfig['validator']
|
||||||
),
|
),
|
||||||
1402326139
|
1402326139
|
||||||
|
@ -115,45 +87,50 @@ class SettingsValidator extends AbstractValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($validatorConfig['property'])) {
|
if (isset($validatorConfig['property'])) {
|
||||||
$this->result->forProperty($validatorConfig['property'])->merge(
|
$this->getResult()->forProperty($validatorConfig['property'])->merge(
|
||||||
$validator->validate(ObjectAccess::getPropertyPath($value, $validatorConfig['property']))
|
$validator->validate(ObjectAccess::getPropertyPath($value, $validatorConfig['property']))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->result->merge($validator->validate($value));
|
$this->getResult()->merge($validator->validate($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param array $validation
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getConfigForName($name): array
|
protected function getConfigForValidation(array $validation): array
|
||||||
{
|
{
|
||||||
$config = [];
|
$config = [];
|
||||||
if (isset($this->validations[$name]['self'])) {
|
|
||||||
foreach ($this->validations[$name]['self'] as $validator => &$validation) {
|
if (isset($validation['self'])) {
|
||||||
if (is_null($validation)) {
|
foreach ($validation['self'] as $validator => $options) {
|
||||||
|
if ($options === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$newValidation['options'] = $validation;
|
$config[] = [
|
||||||
$newValidation['validator'] = $validator;
|
'validator' => $validator,
|
||||||
$config[] = $newValidation;
|
'options' => $options,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($this->validations[$name]['properties'])) {
|
|
||||||
foreach ($this->validations[$name]['properties'] as $propertyName => &$validation) {
|
if (isset($validation['properties'])) {
|
||||||
foreach ($validation as $validator => &$options) {
|
foreach ($validation['properties'] as $property => $propertyValidation) {
|
||||||
if (is_null($options)) {
|
foreach ($propertyValidation as $validator => $options) {
|
||||||
|
if ($options === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$newValidation['property'] = $propertyName;
|
$config[] = [
|
||||||
$newValidation['validator'] = $validator;
|
'property' => $property,
|
||||||
$newValidation['options'] = $options;
|
'validator' => $validator,
|
||||||
$config[] = $newValidation;
|
'options' => $options,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,13 +140,13 @@ class SettingsValidator extends AbstractValidator
|
||||||
* @param array $validatorConfig
|
* @param array $validatorConfig
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function doesValidationGroupsMatch(array &$validatorConfig)
|
protected function doesValidationGroupsMatch(array $validatorConfig): bool
|
||||||
{
|
{
|
||||||
if (isset($validatorConfig['options']['validationGroups']) && empty(array_intersect($validatorConfig['options']['validationGroups'], $this->options['validationGroups']))) {
|
return !isset($validatorConfig['options']['validationGroups'])
|
||||||
return false;
|
|| \array_intersect(
|
||||||
}
|
$validatorConfig['options']['validationGroups'],
|
||||||
|
$this->options['validationGroups']
|
||||||
return true;
|
) !== [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,12 +154,12 @@ class SettingsValidator extends AbstractValidator
|
||||||
*
|
*
|
||||||
* @param array $validatorConfig
|
* @param array $validatorConfig
|
||||||
*/
|
*/
|
||||||
protected function handleValidationGroups(array &$validatorConfig)
|
protected function handleValidationGroups(array &$validatorConfig): void
|
||||||
{
|
{
|
||||||
if (isset($validatorConfig['options']['validationGroups']) && $validatorConfig['validator'] !== 'DigiComp.SettingValidator:Settings') {
|
if ($validatorConfig['validator'] === 'DigiComp.SettingValidator:Settings') {
|
||||||
unset($validatorConfig['options']['validationGroups']);
|
|
||||||
} elseif ($validatorConfig['validator'] === 'DigiComp.SettingValidator:Settings') {
|
|
||||||
$validatorConfig['options']['validationGroups'] = $this->options['validationGroups'];
|
$validatorConfig['options']['validationGroups'] = $this->options['validationGroups'];
|
||||||
|
} elseif (isset($validatorConfig['options']['validationGroups'])) {
|
||||||
|
unset($validatorConfig['options']['validationGroups']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,29 +2,24 @@
|
||||||
|
|
||||||
namespace Neos\Flow\Core\Migrations;
|
namespace Neos\Flow\Core\Migrations;
|
||||||
|
|
||||||
use DigiComp\SettingValidator\Package;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restructures Validation.yamls to new format
|
* Restructures all Validation.yaml to new format
|
||||||
*/
|
*/
|
||||||
class Version20170603120900 extends AbstractMigration
|
class Version20170603120900 extends AbstractMigration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIdentifier()
|
public function getIdentifier(): string
|
||||||
{
|
{
|
||||||
return 'DigiComp.SettingValidator-20170603120900';
|
return 'DigiComp.SettingValidator-20170603120900';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function up(): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
{
|
||||||
$this->processConfiguration(
|
$this->processConfiguration(
|
||||||
Package::CONFIGURATION_TYPE_VALIDATION,
|
'Validation',
|
||||||
function (&$configuration) {
|
function (array &$configuration) {
|
||||||
foreach ($configuration as $validatorName => &$validators) {
|
foreach ($configuration as $validatorName => &$validators) {
|
||||||
// guard that protects configuration, which has already the new format:
|
// guard that protects configuration, which has already the new format:
|
||||||
if (isset($validators['properties']) || isset($validators['self'])) {
|
if (isset($validators['properties']) || isset($validators['self'])) {
|
||||||
|
@ -32,10 +27,12 @@ class Version20170603120900 extends AbstractMigration
|
||||||
}
|
}
|
||||||
$newConfiguration = ['properties' => [], 'self' => []];
|
$newConfiguration = ['properties' => [], 'self' => []];
|
||||||
|
|
||||||
foreach ($validators as $key => &$validator) {
|
foreach ($validators as $key => $validator) {
|
||||||
if (! isset($validator['validator']) || ! isset($validator['options'])) {
|
if (!isset($validator['validator']) || !isset($validator['options'])) {
|
||||||
$this->showWarning('The Validation.yaml files contained no validator or options for ' .
|
$this->showWarning(
|
||||||
'validation: "' . $validatorName . '.' . $key . '". It was not migrated.');
|
'The Validation.yaml files contained no validator or options for validation: ' .
|
||||||
|
'"' . $validatorName . '.' . $key . '". It was not migrated.'
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isset($validator['property'])) {
|
if (isset($validator['property'])) {
|
||||||
|
|
50
README.md
50
README.md
|
@ -1,44 +1,38 @@
|
||||||
DigiComp.SettingValidator
|
# DigiComp.SettingValidator
|
||||||
-------------------------
|
|
||||||
|
|
||||||
|
This Package allows configuring Validators for your Action-Arguments or domain model properties to be set by a new
|
||||||
This Package allows to configure Validators for your Action-Arguments or domain model properties to be set by a new
|
|
||||||
Yaml-File in your Configuration directory.
|
Yaml-File in your Configuration directory.
|
||||||
|
|
||||||
Lets imagine you had this action-method:
|
Let's imagine you had this action-method:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @Flow\Validate(argumentName="order", type="DigiComp.SettingValidator:Settings")
|
||||||
* @param Order $order
|
* @param Order $order
|
||||||
* @Flow\Validate(type="DigiComp.SettingValidator:Settings")
|
|
||||||
*/
|
*/
|
||||||
public function createOrder($order) {...}
|
public function createOrder($order) {...}
|
||||||
|
|
||||||
Then your Validation.yaml could look like this:
|
Then your Validation.yaml could look like this:
|
||||||
|
|
||||||
SuperVendor\SuperPackage\Domain\Model\Order:
|
Vendor\Package\Domain\Model\Order:
|
||||||
-
|
# validates the complete object
|
||||||
property: price
|
self:
|
||||||
validator: NumberRange
|
'Vendor.Package:SomeOtherValidator': []
|
||||||
options:
|
# validates properties of the object
|
||||||
maximum: 20
|
properties:
|
||||||
minimum: 10
|
price:
|
||||||
-
|
NumberRange:
|
||||||
validator: SuperVendor.SuperPackage:SomeOtherValidator #validates the complete object
|
maximum: 20
|
||||||
options: []
|
minimum: 10
|
||||||
-
|
customer:
|
||||||
property: customer
|
'DigiComp.SettingValidator:Settings':
|
||||||
validator: DigiComp.SettingValidator:Settings
|
name: 'OrderCustomer'
|
||||||
options:
|
|
||||||
name: OrderCustomer
|
|
||||||
|
|
||||||
OrderCustomer:
|
OrderCustomer:
|
||||||
-
|
properties:
|
||||||
property: firstName
|
firstName:
|
||||||
validator: StringLength
|
StringLength:
|
||||||
options:
|
minimum: 3
|
||||||
minimum: 3
|
maximum: 20
|
||||||
maximum: 20
|
|
||||||
|
|
||||||
|
|
||||||
As you see: Nesting is possible ;) That way you can easily construct flexible structures.
|
As you see: Nesting is possible ;) That way you can easily construct flexible structures.
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,18 @@ class TestObject
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeTrue = true;
|
protected bool $shouldBeTrue = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeFalse = true;
|
protected bool $shouldBeFalse = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="TrueValidator"})
|
* @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="TrueValidator"})
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeTrueAndValidatedByAnnotation = false;
|
protected bool $shouldBeTrueAndValidatedByAnnotation = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
@ -7,12 +7,12 @@ class TestValidationGroupsCustomObject
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeTrue = false;
|
protected bool $shouldBeTrue = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeFalse = true;
|
protected bool $shouldBeFalse = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
@ -7,12 +7,12 @@ class TestValidationGroupsDefaultObject
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeTrue = false;
|
protected bool $shouldBeTrue = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $shouldBeFalse = true;
|
protected bool $shouldBeFalse = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
@ -7,14 +7,18 @@ use DigiComp\SettingValidator\Tests\Functional\Fixtures\TestValidationGroupsCust
|
||||||
use DigiComp\SettingValidator\Tests\Functional\Fixtures\TestValidationGroupsDefaultObject;
|
use DigiComp\SettingValidator\Tests\Functional\Fixtures\TestValidationGroupsDefaultObject;
|
||||||
use DigiComp\SettingValidator\Validation\Validator\SettingsValidator;
|
use DigiComp\SettingValidator\Validation\Validator\SettingsValidator;
|
||||||
use Neos\Flow\Tests\FunctionalTestCase;
|
use Neos\Flow\Tests\FunctionalTestCase;
|
||||||
|
use Neos\Flow\Validation\Exception\InvalidValidationConfigurationException;
|
||||||
|
use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
|
||||||
|
use Neos\Flow\Validation\Exception\NoSuchValidatorException;
|
||||||
use Neos\Flow\Validation\ValidatorResolver;
|
use Neos\Flow\Validation\ValidatorResolver;
|
||||||
|
|
||||||
class SettingsValidatorTest extends FunctionalTestCase
|
class SettingsValidatorTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @throws InvalidValidationOptionsException
|
||||||
*/
|
*/
|
||||||
public function ifNoNameIsGivenClassNameIsUsed()
|
public function ifNoNameIsGivenClassNameIsUsed(): void
|
||||||
{
|
{
|
||||||
$validator = $this->objectManager->get(SettingsValidator::class);
|
$validator = $this->objectManager->get(SettingsValidator::class);
|
||||||
$result = $validator->validate(new TestObject());
|
$result = $validator->validate(new TestObject());
|
||||||
|
@ -25,8 +29,11 @@ class SettingsValidatorTest extends FunctionalTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @throws InvalidValidationConfigurationException
|
||||||
|
* @throws InvalidValidationOptionsException
|
||||||
|
* @throws NoSuchValidatorException
|
||||||
*/
|
*/
|
||||||
public function conjunctionValidationWorksAsExpected()
|
public function conjunctionValidationWorksAsExpected(): void
|
||||||
{
|
{
|
||||||
$validatorResolver = $this->objectManager->get(ValidatorResolver::class);
|
$validatorResolver = $this->objectManager->get(ValidatorResolver::class);
|
||||||
$validator = $validatorResolver->getBaseValidatorConjunction(TestObject::class);
|
$validator = $validatorResolver->getBaseValidatorConjunction(TestObject::class);
|
||||||
|
@ -37,8 +44,9 @@ class SettingsValidatorTest extends FunctionalTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @throws InvalidValidationOptionsException
|
||||||
*/
|
*/
|
||||||
public function defaultValidationGroupWorks()
|
public function defaultValidationGroupWorks(): void
|
||||||
{
|
{
|
||||||
$validator = $this->objectManager->get(SettingsValidator::class, ['validationGroups' => ['Default']]);
|
$validator = $this->objectManager->get(SettingsValidator::class, ['validationGroups' => ['Default']]);
|
||||||
$result = $validator->validate(new TestValidationGroupsDefaultObject());
|
$result = $validator->validate(new TestValidationGroupsDefaultObject());
|
||||||
|
@ -49,8 +57,9 @@ class SettingsValidatorTest extends FunctionalTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @throws InvalidValidationOptionsException
|
||||||
*/
|
*/
|
||||||
public function customValidationGroupWorks()
|
public function customValidationGroupWorks(): void
|
||||||
{
|
{
|
||||||
$validator = $this->objectManager->get(SettingsValidator::class, ['validationGroups' => ['Custom']]);
|
$validator = $this->objectManager->get(SettingsValidator::class, ['validationGroups' => ['Custom']]);
|
||||||
$result = $validator->validate(new TestValidationGroupsCustomObject());
|
$result = $validator->validate(new TestValidationGroupsCustomObject());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "digicomp/settingvalidator",
|
"name": "digicomp/settingvalidator",
|
||||||
"type": "neos-package",
|
|
||||||
"description": "Just a Neos\\Flow Validator resolving other Validators with Configuration/Validation.yaml",
|
"description": "Just a Neos\\Flow Validator resolving other Validators with Configuration/Validation.yaml",
|
||||||
|
"type": "neos-package",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Ferdinand Kuhl",
|
"name": "Ferdinand Kuhl",
|
||||||
|
@ -18,7 +18,8 @@
|
||||||
"validation"
|
"validation"
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"neos/flow": "~4.1|^5.3"
|
"neos/flow": "^6.2.3",
|
||||||
|
"php": "~7.4.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -31,9 +32,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
"neos": {
|
||||||
|
"package-key": "DigiComp.SettingValidator"
|
||||||
|
},
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-develop": "2.0.x-dev",
|
"dev-develop": "3.0.x-dev",
|
||||||
"dev-version/1.x-dev": "1.0.x-dev"
|
"dev-version/1.x-dev": "1.1.x-dev"
|
||||||
},
|
},
|
||||||
"applied-flow-migrations": [
|
"applied-flow-migrations": [
|
||||||
"Inwebs.Basket-201409170938",
|
"Inwebs.Basket-201409170938",
|
||||||
|
@ -67,7 +71,9 @@
|
||||||
"Neos.Flow-20170125103800",
|
"Neos.Flow-20170125103800",
|
||||||
"Neos.Flow-20170127183102",
|
"Neos.Flow-20170127183102",
|
||||||
"DigiComp.SettingValidator-20170603120900",
|
"DigiComp.SettingValidator-20170603120900",
|
||||||
"Neos.Flow-20180415105700"
|
"Neos.Flow-20180415105700",
|
||||||
|
"Neos.Flow-20190425144900",
|
||||||
|
"Neos.Flow-20190515215000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue