[BUGFIX] Harden ValidatorResolver and add functional tests
This patch mainly converts several unit tests with heavy mocking to functional tests with real fixtures instead of 'eval()'ed classes. During that seperation two minor bugs have been fixed: - "resolveValidatorObjectName" tried to find non FQCN validators by checking for a colon, an underscore or a backslash. That way it found shorthand validators like "TYPO3.CMS.Extbase:NotEmpty" and validators without any extension reference. e.g. "NotEmpty". While that check itself is not a problem, the resolver furthermore explodes the validator name by colons, which fails for validator names without extension reference. This has been fixed by an additional elseif. - Another small bug has been fixed in the method "buildBaseValidatorConjunction". While aggregating the validator annotations, the method "parseValidatorAnnotation" is called that returns an array with the annotation information. If the information is built for a method param, the key argumentName is set. However, this is not the case for properties but following code relied on argumentName being present. argumentName is now explicitly set to null if not given. Releases: master Resolves: #83481 Change-Id: I413b85ad905c19f6ae7daef8f5d97aeeab2edb90 Reviewed-on: https://review.typo3.org/55275 Tested-by:TYPO3com <no-reply@typo3.com> Reviewed-by:
Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by:
Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php 7 additions, 6 deletions...3/sysext/extbase/Classes/Validation/ValidatorResolver.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Controller/TestController.php 28 additions, 0 deletions...nctional/Validation/Fixture/Controller/TestController.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Domain/Model/AnotherModel.php 30 additions, 0 deletions...nctional/Validation/Fixture/Domain/Model/AnotherModel.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Domain/Model/Model.php 47 additions, 0 deletions...ests/Functional/Validation/Fixture/Domain/Model/Model.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Domain/Validator/ModelValidator.php 29 additions, 0 deletions...al/Validation/Fixture/Domain/Validator/ModelValidator.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Validation/Validator/CustomValidator.php 29 additions, 0 deletions...lidation/Fixture/Validation/Validator/CustomValidator.php
- typo3/sysext/extbase/Tests/Functional/Validation/Fixture/Validation/Validator/CustomValidatorThatDoesNotImplementValidatorInterfaceValidator.php 29 additions, 0 deletions...idatorThatDoesNotImplementValidatorInterfaceValidator.php
- typo3/sysext/extbase/Tests/Functional/Validation/ValidatorResolverTest.php 253 additions, 0 deletions...ase/Tests/Functional/Validation/ValidatorResolverTest.php
- typo3/sysext/extbase/Tests/Unit/Validation/ValidatorResolverTest.php 16 additions, 394 deletions...t/extbase/Tests/Unit/Validation/ValidatorResolverTest.php
Please register or sign in to comment