File: |
tests/GeneratorTest.php |
Role: |
Class source |
Content type: |
text/plain |
Description: |
Class source |
Class: |
PHP Password Validation Helper
Generate and check a password according to rules |
Author: |
By John Conde |
Last change: |
refactor: break down Generator::generate() into smaller methods
- Split generate() method into smaller, focused methods for better maintainability:
- validateCharacterTypes(): Validates character type selection
- buildCharacterPool(): Creates character pool based on selected types
- generateRequiredCharacters(): Ensures required character types
- fillRemainingCharacters(): Fills remaining password length
- Added comprehensive unit tests for new private methods
- Improved code readability and maintainability
- Maintained existing functionality while reducing method complexity
- All tests passing (55 tests, 125 assertions)
This refactoring makes the code more modular and easier to maintain while
preserving the original password generation logic and security requirements.
refactor: update codebase for PHP 8.0 compatibility
- Updated test cases in PolicyTest, ValidatorTest, and GeneratorTest to match the new class interfaces and expectations.
- Added getter methods for minLength and maxLength in the Generator class.
- Updated assertions in GeneratorTest to use PHPUnit 8.5 compatible methods.
- Adjusted test expectations in ValidatorTest to align with the current validation logic.
This refactoring ensures that the codebase is fully compatible with PHP 8.0 while maintaining the intended functionality and test coverage.
|
Date: |
7 days ago |
Size: |
6,175 bytes |
|
|
|