| File: |
tests/BanTest.php |
| Role: |
Class source |
| Content type: |
text/plain |
| Description: |
Class source |
| Class: |
PHP Not Allowed
Detect and filter unwanted information |
| Author: |
By Pierre-Henry Soria |
| Last change: |
Use backed enum in combination with `match()` to get rid of `switch` statement
These changes require now PHP 8.1 or higher as enums are available only since PHP 8.1+
Fix type declations on argument
BanTest: Renamme constant name + adding return `void` type
Fix unit tests & indentation cleanup
Fix coding style indentation
Update BanTest.php
Add informative comment
Fixing path `Ban::mergeFile` to avoid `realpath` returning FALSE
Fixing the path to avoid `realpath` giving FALSE when running unit tests
Fixing path
We would need to mention the `/tests` folder as the tests are being ran from the main project folder
Moved test extended files to banned-data subdir
Add support to validate that all provided values in a set are banned
- Add a `isAny(array $value, bool $email = false, bool $word = false, bool $username = false, bool $ip = false, bool $bank_accounts = false)` method
- This method returns true if any of the provided values is banned in any of the paths selected
- This method short circuits
- Add a `isAll(array $value, bool $email = false, bool $word = false, bool $username = false, bool $ip = false, bool $bank_accounts = false)` method
- This method returns true if ALL of the provided values are banned across all the paths selected
- This method short circuits
- Add unit tests accordingly
Add support for extending banned content
- Added a way to merge value[s] and user defined/provided files
- Added unit tests accordingly
Add support for multiple value validation
- Changed each public method signature to allow intake of string or array of values
- Changed the entire Ban control flow to be more functional programming based to support
multiple value validation
- Add unit tests for intake of array of values accordingly
Update BanTest.php
Update: Better blacklisted IPs list
|
| Date: |
7 months ago |
| Size: |
8,681 bytes |
|
|
|