Skip to content

Conversation

walmir-silva
Copy link
Contributor

  • Refactor validation processors for better modularity and flexibility
  • Optimize IntegerValidator and DateRangeValidator to improve performance
  • Add DateValidatorException and enhance exception handling in date validators
  • Add unit tests covering:
    • Validate attribute
    • DateFormatValidator, EmailValidator, LengthValidator
    • ConditionalValidator, RequiredValidator
    • Exception handling in DateValidatorException and DateRangeValidator
  • Update README with documentation in English and Brazilian Portuguese for validation components
- Added attribute-based validation using the `Validate` attribute - Implemented EmailValidator and RangeValidator for common validation tasks - Integrated ContentValidator for pipeline-based entity validation - Added exception handling with ValidationException and PSR-3 logging support
- Added `Validate` attribute for validation configuration. - Created `ValidationException` for handling validation-related exceptions. - Introduced `AbstractValidatorProcessor` as a base class for all validators. - Added date processors: `DateFormatValidator` and `DateRangeValidator`. - Added input processors: `EmailValidator`, `LengthValidator`, and `UrlValidator`. - Added logic processors: `ConditionalValidator` and `RequiredValidator`. - Added numeric processors: `IntegerValidator` and `RangeValidator`. - Implemented main `Validator` class to manage validations. - Updated `composer.json` and `composer.lock` for dependencies. - Modified `tests/application.php` to include new validation tests.
- Add new validation result contract and processor interfaces. - Introduce `MissingProcessorConfigException` for better error handling. - Replace `ValidationException` with more specific exception handling. - Update various processors (`LengthValidator`, `EmailValidator`, `UrlValidator`, etc.) to handle configuration properly. - Implement `DefaultValidationResultProcessor` for standardized result processing. - Adjust `DateFormatValidator` and `DateRangeValidator` to improve validation accuracy. - Remove legacy validation exception logic.
- Added tests to ensure Validate implements ProcessableAttribute and CustomizableMessageAttribute interfaces. - Verified that Validate can handle single and multiple processors, including processors with configurations. - Implemented tests for filtering invalid processors. - Added message handling tests to validate messages associated with specific processors. - Ensured compatibility with both configured and non-configured processors.
…alidator, and UrlValidator - Added unit tests for DateFormatValidator to validate default and custom date formats, along with invalid formats and data types. - Added unit tests for EmailValidator to validate correct email formats, handle invalid formats, and manage incorrect data types. - Implemented tests for LengthValidator to handle valid lengths, input that is too short or too long, and incorrect data types. Also covered missing or incomplete configuration cases. - Added unit tests for UrlValidator to check valid and invalid URL formats, as well as invalid data types.
- Added tests for ConditionalValidator to validate custom conditions and associated validation logic. - Included tests for cases where the condition is met or not met, and how it handles valid and invalid input. - Added unit tests for RequiredValidator to ensure that fields are correctly marked as required. - Covered cases for empty values, non-empty values, and handling different data types.
- Optimized IntegerValidator by refactoring the isValidInteger method to improve readability and efficiency. - Replaced multiple if statements with a single return expression for cleaner and more concise code. - Added IntegerValidatorTest to ensure correct handling of valid and invalid integers, including negative values and edge cases. - Updated ConditionalValidatorTest to ensure consistent testing for conditional logic.
… custom exceptions - Added DateValidatorException to handle invalid date format errors. - Refactored DateRangeValidator to use DateValidatorException and MissingProcessorConfigException for more consistent error handling. - Improved date parsing logic in DateRangeValidator to throw specific exceptions for missing configurations and invalid date formats. - Added unit tests for DateRangeValidator, covering valid and invalid date ranges, custom date formats, and error handling for missing configurations. - Added RangeValidatorTest to validate correct behavior of range validation for numeric values.
This commit adds comprehensive test coverage for the validator module: - DefaultValidationResultProcessorTest: Tests validation result processing including: - Valid data processing - Error handling - Multiple errors for same property - Empty property handling - Mixed valid/invalid property cases - ValidationResultTest: Tests validation result management including: - Error addition and retrieval - Validated data storage - State management - Data type handling - Array serialization - Duplicate error prevention - ValidatorTest: Tests core validator functionality including: - Object validation - Attribute processing - Error collection - Result generation - Integration with processors
 - Created a new unit test for DateValidatorException to ensure proper validation error handling. - new file: tests/Exception/DateValidatorExceptionTest.php
 - Modified the test to improve exception handling verification in DateRangeValidator. - modified: tests/Processor/Date/DateRangeValidatorTest.php
 - English version with complete validator component documentation - Brazilian Portuguese translation with localized examples - Both versions include: - Detailed feature descriptions - Installation and usage guides - Available validators catalog - Configuration instructions - Development setup - Testing procedures - Integration guides
@walmir-silva walmir-silva merged commit 885b4b1 into main Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant