From a5fb85f351a819f21027553ceb6dbd550e801e02 Mon Sep 17 00:00:00 2001 From: Denis Smet Date: Thu, 14 Mar 2024 02:02:05 +0400 Subject: [PATCH] Refactor Validators and Rules structure Reorganized and refactored the architecture of Validators and Rules within the codebase. The Rules were moved under the base namespace rather than under Validators. Additionally, implemented the ColumnValidator and ScvValidator, and refactored the abstract base Validator class into AbstractValidator. Adjustments were also applied to unit tests receiving the impact of these changes, ensuring comprehensive test coverage over the refactored structure. --- src/Csv/Column.php | 4 +- src/Csv/CsvFile.php | 2 + src/{Validators => }/Rules/AbstarctRule.php | 2 +- src/{Validators => }/Rules/AllowValues.php | 2 +- .../Rules/CardinalDirection.php | 2 +- src/{Validators => }/Rules/DateFormat.php | 2 +- src/{Validators => }/Rules/ExactValue.php | 2 +- src/{Validators => }/Rules/IsBool.php | 2 +- src/{Validators => }/Rules/IsDomain.php | 2 +- src/{Validators => }/Rules/IsEmail.php | 2 +- src/{Validators => }/Rules/IsFloat.php | 2 +- src/{Validators => }/Rules/IsInt.php | 2 +- src/{Validators => }/Rules/IsIp.php | 2 +- src/{Validators => }/Rules/IsLatitude.php | 2 +- src/{Validators => }/Rules/IsLongitude.php | 2 +- src/{Validators => }/Rules/IsUrl.php | 2 +- src/{Validators => }/Rules/IsUuid4.php | 2 +- src/{Validators => }/Rules/Max.php | 2 +- src/{Validators => }/Rules/MaxDate.php | 2 +- src/{Validators => }/Rules/MaxLength.php | 2 +- src/{Validators => }/Rules/Min.php | 2 +- src/{Validators => }/Rules/MinDate.php | 2 +- src/{Validators => }/Rules/MinLength.php | 2 +- src/{Validators => }/Rules/NotEmpty.php | 2 +- src/{Validators => }/Rules/OnlyCapitalize.php | 2 +- src/{Validators => }/Rules/OnlyLowercase.php | 2 +- src/{Validators => }/Rules/OnlyTrimed.php | 2 +- src/{Validators => }/Rules/OnlyUppercase.php | 2 +- src/{Validators => }/Rules/Precision.php | 2 +- src/{Validators => }/Rules/Regex.php | 2 +- src/{Validators => }/Rules/RuleException.php | 2 +- src/{Validators => }/Rules/UsaMarketName.php | 2 +- src/Validators/AbstractValidator.php | 22 ++++++++ .../{Validator.php => ColumnValidator.php} | 2 +- src/Validators/Ruleset.php | 4 +- src/Validators/ScvValidator.php | 25 +++++++++ tests/Blueprint/MiscTest.php | 2 +- tests/Blueprint/RulesTest.php | 54 +++++++++---------- tests/Blueprint/ValidatorTest.php | 2 +- 39 files changed, 113 insertions(+), 64 deletions(-) rename src/{Validators => }/Rules/AbstarctRule.php (98%) rename src/{Validators => }/Rules/AllowValues.php (95%) rename src/{Validators => }/Rules/CardinalDirection.php (94%) rename src/{Validators => }/Rules/DateFormat.php (96%) rename src/{Validators => }/Rules/ExactValue.php (94%) rename src/{Validators => }/Rules/IsBool.php (94%) rename src/{Validators => }/Rules/IsDomain.php (94%) rename src/{Validators => }/Rules/IsEmail.php (94%) rename src/{Validators => }/Rules/IsFloat.php (94%) rename src/{Validators => }/Rules/IsInt.php (94%) rename src/{Validators => }/Rules/IsIp.php (94%) rename src/{Validators => }/Rules/IsLatitude.php (95%) rename src/{Validators => }/Rules/IsLongitude.php (95%) rename src/{Validators => }/Rules/IsUrl.php (94%) rename src/{Validators => }/Rules/IsUuid4.php (94%) rename src/{Validators => }/Rules/Max.php (94%) rename src/{Validators => }/Rules/MaxDate.php (94%) rename src/{Validators => }/Rules/MaxLength.php (94%) rename src/{Validators => }/Rules/Min.php (94%) rename src/{Validators => }/Rules/MinDate.php (94%) rename src/{Validators => }/Rules/MinLength.php (94%) rename src/{Validators => }/Rules/NotEmpty.php (93%) rename src/{Validators => }/Rules/OnlyCapitalize.php (94%) rename src/{Validators => }/Rules/OnlyLowercase.php (94%) rename src/{Validators => }/Rules/OnlyTrimed.php (94%) rename src/{Validators => }/Rules/OnlyUppercase.php (94%) rename src/{Validators => }/Rules/Precision.php (96%) rename src/{Validators => }/Rules/Regex.php (95%) rename src/{Validators => }/Rules/RuleException.php (90%) rename src/{Validators => }/Rules/UsaMarketName.php (94%) create mode 100644 src/Validators/AbstractValidator.php rename src/Validators/{Validator.php => ColumnValidator.php} (93%) create mode 100644 src/Validators/ScvValidator.php diff --git a/src/Csv/Column.php b/src/Csv/Column.php index 1cc88b66..d873d784 100644 --- a/src/Csv/Column.php +++ b/src/Csv/Column.php @@ -18,7 +18,7 @@ use JBZoo\CsvBlueprint\Utils; use JBZoo\CsvBlueprint\Validators\ErrorSuite; -use JBZoo\CsvBlueprint\Validators\Validator; +use JBZoo\CsvBlueprint\Validators\ColumnValidator; use JBZoo\Data\Data; final class Column @@ -111,7 +111,7 @@ public function getInherit(): string public function validate(string $cellValue, int $line): ErrorSuite { - return (new Validator($this))->validate($cellValue, $line); + return (new ColumnValidator($this))->validate($cellValue, $line); } private function prepareRuleSet(string $schemaKey): array diff --git a/src/Csv/CsvFile.php b/src/Csv/CsvFile.php index 65d52eb1..f7cdc64f 100644 --- a/src/Csv/CsvFile.php +++ b/src/Csv/CsvFile.php @@ -81,6 +81,8 @@ public function getRecordsChunk(int $offset = 0, int $limit = -1): TabularDataRe public function validate(bool $quickStop = false): ErrorSuite { + // $fileValidator + $errors = new ErrorSuite($this->getCsvFilename()); $errors diff --git a/src/Validators/Rules/AbstarctRule.php b/src/Rules/AbstarctRule.php similarity index 98% rename from src/Validators/Rules/AbstarctRule.php rename to src/Rules/AbstarctRule.php index d97bcb05..dd827158 100644 --- a/src/Validators/Rules/AbstarctRule.php +++ b/src/Rules/AbstarctRule.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; use JBZoo\CsvBlueprint\Utils; use JBZoo\CsvBlueprint\Validators\Error; diff --git a/src/Validators/Rules/AllowValues.php b/src/Rules/AllowValues.php similarity index 95% rename from src/Validators/Rules/AllowValues.php rename to src/Rules/AllowValues.php index 11dbcf21..6541d2e5 100644 --- a/src/Validators/Rules/AllowValues.php +++ b/src/Rules/AllowValues.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; class AllowValues extends AbstarctRule { diff --git a/src/Validators/Rules/CardinalDirection.php b/src/Rules/CardinalDirection.php similarity index 94% rename from src/Validators/Rules/CardinalDirection.php rename to src/Rules/CardinalDirection.php index f1cf9be9..d27d3d15 100644 --- a/src/Validators/Rules/CardinalDirection.php +++ b/src/Rules/CardinalDirection.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; class CardinalDirection extends AllowValues { diff --git a/src/Validators/Rules/DateFormat.php b/src/Rules/DateFormat.php similarity index 96% rename from src/Validators/Rules/DateFormat.php rename to src/Rules/DateFormat.php index ec3f80da..49bdfefe 100644 --- a/src/Validators/Rules/DateFormat.php +++ b/src/Rules/DateFormat.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class DateFormat extends AbstarctRule { diff --git a/src/Validators/Rules/ExactValue.php b/src/Rules/ExactValue.php similarity index 94% rename from src/Validators/Rules/ExactValue.php rename to src/Rules/ExactValue.php index 317aa0cb..1914320a 100644 --- a/src/Validators/Rules/ExactValue.php +++ b/src/Rules/ExactValue.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class ExactValue extends AbstarctRule { diff --git a/src/Validators/Rules/IsBool.php b/src/Rules/IsBool.php similarity index 94% rename from src/Validators/Rules/IsBool.php rename to src/Rules/IsBool.php index e4260f5b..51a59dc8 100644 --- a/src/Validators/Rules/IsBool.php +++ b/src/Rules/IsBool.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsBool extends AllowValues { diff --git a/src/Validators/Rules/IsDomain.php b/src/Rules/IsDomain.php similarity index 94% rename from src/Validators/Rules/IsDomain.php rename to src/Rules/IsDomain.php index e815db76..ac3628e4 100644 --- a/src/Validators/Rules/IsDomain.php +++ b/src/Rules/IsDomain.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsDomain extends AbstarctRule { diff --git a/src/Validators/Rules/IsEmail.php b/src/Rules/IsEmail.php similarity index 94% rename from src/Validators/Rules/IsEmail.php rename to src/Rules/IsEmail.php index f26cc9dc..3d812588 100644 --- a/src/Validators/Rules/IsEmail.php +++ b/src/Rules/IsEmail.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsEmail extends AbstarctRule { diff --git a/src/Validators/Rules/IsFloat.php b/src/Rules/IsFloat.php similarity index 94% rename from src/Validators/Rules/IsFloat.php rename to src/Rules/IsFloat.php index 644b11aa..a4bb73e7 100644 --- a/src/Validators/Rules/IsFloat.php +++ b/src/Rules/IsFloat.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; class IsFloat extends AbstarctRule { diff --git a/src/Validators/Rules/IsInt.php b/src/Rules/IsInt.php similarity index 94% rename from src/Validators/Rules/IsInt.php rename to src/Rules/IsInt.php index 4581f04a..792369d9 100644 --- a/src/Validators/Rules/IsInt.php +++ b/src/Rules/IsInt.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsInt extends AbstarctRule { diff --git a/src/Validators/Rules/IsIp.php b/src/Rules/IsIp.php similarity index 94% rename from src/Validators/Rules/IsIp.php rename to src/Rules/IsIp.php index ccc5fc98..437a000c 100644 --- a/src/Validators/Rules/IsIp.php +++ b/src/Rules/IsIp.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsIp extends AbstarctRule { diff --git a/src/Validators/Rules/IsLatitude.php b/src/Rules/IsLatitude.php similarity index 95% rename from src/Validators/Rules/IsLatitude.php rename to src/Rules/IsLatitude.php index 7a670fb6..67ba570e 100644 --- a/src/Validators/Rules/IsLatitude.php +++ b/src/Rules/IsLatitude.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsLatitude extends IsFloat { diff --git a/src/Validators/Rules/IsLongitude.php b/src/Rules/IsLongitude.php similarity index 95% rename from src/Validators/Rules/IsLongitude.php rename to src/Rules/IsLongitude.php index 31f2a53b..542d8503 100644 --- a/src/Validators/Rules/IsLongitude.php +++ b/src/Rules/IsLongitude.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsLongitude extends IsFloat { diff --git a/src/Validators/Rules/IsUrl.php b/src/Rules/IsUrl.php similarity index 94% rename from src/Validators/Rules/IsUrl.php rename to src/Rules/IsUrl.php index f2fba082..fc072f9d 100644 --- a/src/Validators/Rules/IsUrl.php +++ b/src/Rules/IsUrl.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsUrl extends AbstarctRule { diff --git a/src/Validators/Rules/IsUuid4.php b/src/Rules/IsUuid4.php similarity index 94% rename from src/Validators/Rules/IsUuid4.php rename to src/Rules/IsUuid4.php index 86a5b55b..f47fd5bd 100644 --- a/src/Validators/Rules/IsUuid4.php +++ b/src/Rules/IsUuid4.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class IsUuid4 extends AbstarctRule { diff --git a/src/Validators/Rules/Max.php b/src/Rules/Max.php similarity index 94% rename from src/Validators/Rules/Max.php rename to src/Rules/Max.php index 7a0cb9bc..eb96587a 100644 --- a/src/Validators/Rules/Max.php +++ b/src/Rules/Max.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class Max extends IsFloat { diff --git a/src/Validators/Rules/MaxDate.php b/src/Rules/MaxDate.php similarity index 94% rename from src/Validators/Rules/MaxDate.php rename to src/Rules/MaxDate.php index 3dc0612f..504df30f 100644 --- a/src/Validators/Rules/MaxDate.php +++ b/src/Rules/MaxDate.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class MaxDate extends AbstarctRule { diff --git a/src/Validators/Rules/MaxLength.php b/src/Rules/MaxLength.php similarity index 94% rename from src/Validators/Rules/MaxLength.php rename to src/Rules/MaxLength.php index 515cdb74..5d18a6d8 100644 --- a/src/Validators/Rules/MaxLength.php +++ b/src/Rules/MaxLength.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class MaxLength extends AbstarctRule { diff --git a/src/Validators/Rules/Min.php b/src/Rules/Min.php similarity index 94% rename from src/Validators/Rules/Min.php rename to src/Rules/Min.php index ee340fcb..c6c2cfda 100644 --- a/src/Validators/Rules/Min.php +++ b/src/Rules/Min.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class Min extends IsFloat { diff --git a/src/Validators/Rules/MinDate.php b/src/Rules/MinDate.php similarity index 94% rename from src/Validators/Rules/MinDate.php rename to src/Rules/MinDate.php index e9435a6b..3c4ae330 100644 --- a/src/Validators/Rules/MinDate.php +++ b/src/Rules/MinDate.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class MinDate extends AbstarctRule { diff --git a/src/Validators/Rules/MinLength.php b/src/Rules/MinLength.php similarity index 94% rename from src/Validators/Rules/MinLength.php rename to src/Rules/MinLength.php index 10120131..bb7b9957 100644 --- a/src/Validators/Rules/MinLength.php +++ b/src/Rules/MinLength.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class MinLength extends AbstarctRule { diff --git a/src/Validators/Rules/NotEmpty.php b/src/Rules/NotEmpty.php similarity index 93% rename from src/Validators/Rules/NotEmpty.php rename to src/Rules/NotEmpty.php index b99339d7..6a936c8d 100644 --- a/src/Validators/Rules/NotEmpty.php +++ b/src/Rules/NotEmpty.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class NotEmpty extends AbstarctRule { diff --git a/src/Validators/Rules/OnlyCapitalize.php b/src/Rules/OnlyCapitalize.php similarity index 94% rename from src/Validators/Rules/OnlyCapitalize.php rename to src/Rules/OnlyCapitalize.php index 99b011f2..f426f3fb 100644 --- a/src/Validators/Rules/OnlyCapitalize.php +++ b/src/Rules/OnlyCapitalize.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class OnlyCapitalize extends AbstarctRule { diff --git a/src/Validators/Rules/OnlyLowercase.php b/src/Rules/OnlyLowercase.php similarity index 94% rename from src/Validators/Rules/OnlyLowercase.php rename to src/Rules/OnlyLowercase.php index 54bd838e..a5fe11e6 100644 --- a/src/Validators/Rules/OnlyLowercase.php +++ b/src/Rules/OnlyLowercase.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class OnlyLowercase extends AbstarctRule { diff --git a/src/Validators/Rules/OnlyTrimed.php b/src/Rules/OnlyTrimed.php similarity index 94% rename from src/Validators/Rules/OnlyTrimed.php rename to src/Rules/OnlyTrimed.php index 60d3b0c8..f55053b9 100644 --- a/src/Validators/Rules/OnlyTrimed.php +++ b/src/Rules/OnlyTrimed.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class OnlyTrimed extends AbstarctRule { diff --git a/src/Validators/Rules/OnlyUppercase.php b/src/Rules/OnlyUppercase.php similarity index 94% rename from src/Validators/Rules/OnlyUppercase.php rename to src/Rules/OnlyUppercase.php index 6546547e..839fe5d4 100644 --- a/src/Validators/Rules/OnlyUppercase.php +++ b/src/Rules/OnlyUppercase.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class OnlyUppercase extends AbstarctRule { diff --git a/src/Validators/Rules/Precision.php b/src/Rules/Precision.php similarity index 96% rename from src/Validators/Rules/Precision.php rename to src/Rules/Precision.php index f6106e31..df2c51af 100644 --- a/src/Validators/Rules/Precision.php +++ b/src/Rules/Precision.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; final class Precision extends AbstarctRule { diff --git a/src/Validators/Rules/Regex.php b/src/Rules/Regex.php similarity index 95% rename from src/Validators/Rules/Regex.php rename to src/Rules/Regex.php index 356cbdb1..95e2be6e 100644 --- a/src/Validators/Rules/Regex.php +++ b/src/Rules/Regex.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; use JBZoo\CsvBlueprint\Utils; diff --git a/src/Validators/Rules/RuleException.php b/src/Rules/RuleException.php similarity index 90% rename from src/Validators/Rules/RuleException.php rename to src/Rules/RuleException.php index 48ed9cb6..d0e06b41 100644 --- a/src/Validators/Rules/RuleException.php +++ b/src/Rules/RuleException.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; class RuleException extends \JBZoo\CsvBlueprint\Exception { diff --git a/src/Validators/Rules/UsaMarketName.php b/src/Rules/UsaMarketName.php similarity index 94% rename from src/Validators/Rules/UsaMarketName.php rename to src/Rules/UsaMarketName.php index 0979b6ea..d381d25c 100644 --- a/src/Validators/Rules/UsaMarketName.php +++ b/src/Rules/UsaMarketName.php @@ -14,7 +14,7 @@ declare(strict_types=1); -namespace JBZoo\CsvBlueprint\Validators\Rules; +namespace JBZoo\CsvBlueprint\Rules; class UsaMarketName extends AllowValues { diff --git a/src/Validators/AbstractValidator.php b/src/Validators/AbstractValidator.php new file mode 100644 index 00000000..de339246 --- /dev/null +++ b/src/Validators/AbstractValidator.php @@ -0,0 +1,22 @@ +columnNameId, $options); diff --git a/src/Validators/ScvValidator.php b/src/Validators/ScvValidator.php new file mode 100644 index 00000000..7bdc0011 --- /dev/null +++ b/src/Validators/ScvValidator.php @@ -0,0 +1,25 @@ +files() - ->in(PROJECT_ROOT . '/src/Validators/Rules') + ->in(PROJECT_ROOT . '/src/Rules') ->ignoreDotFiles(false) ->ignoreVCS(true) ->name('/\\.php$/'); diff --git a/tests/Blueprint/RulesTest.php b/tests/Blueprint/RulesTest.php index 69f97883..cad32907 100644 --- a/tests/Blueprint/RulesTest.php +++ b/tests/Blueprint/RulesTest.php @@ -16,33 +16,33 @@ namespace JBZoo\PHPUnit\Blueprint; -use JBZoo\CsvBlueprint\Validators\Rules\AllowValues; -use JBZoo\CsvBlueprint\Validators\Rules\CardinalDirection; -use JBZoo\CsvBlueprint\Validators\Rules\DateFormat; -use JBZoo\CsvBlueprint\Validators\Rules\ExactValue; -use JBZoo\CsvBlueprint\Validators\Rules\IsBool; -use JBZoo\CsvBlueprint\Validators\Rules\IsDomain; -use JBZoo\CsvBlueprint\Validators\Rules\IsEmail; -use JBZoo\CsvBlueprint\Validators\Rules\IsFloat; -use JBZoo\CsvBlueprint\Validators\Rules\IsInt; -use JBZoo\CsvBlueprint\Validators\Rules\IsIp; -use JBZoo\CsvBlueprint\Validators\Rules\IsLatitude; -use JBZoo\CsvBlueprint\Validators\Rules\IsLongitude; -use JBZoo\CsvBlueprint\Validators\Rules\IsUrl; -use JBZoo\CsvBlueprint\Validators\Rules\IsUuid4; -use JBZoo\CsvBlueprint\Validators\Rules\Max; -use JBZoo\CsvBlueprint\Validators\Rules\MaxDate; -use JBZoo\CsvBlueprint\Validators\Rules\MaxLength; -use JBZoo\CsvBlueprint\Validators\Rules\Min; -use JBZoo\CsvBlueprint\Validators\Rules\MinDate; -use JBZoo\CsvBlueprint\Validators\Rules\MinLength; -use JBZoo\CsvBlueprint\Validators\Rules\NotEmpty; -use JBZoo\CsvBlueprint\Validators\Rules\OnlyCapitalize; -use JBZoo\CsvBlueprint\Validators\Rules\OnlyLowercase; -use JBZoo\CsvBlueprint\Validators\Rules\OnlyUppercase; -use JBZoo\CsvBlueprint\Validators\Rules\Precision; -use JBZoo\CsvBlueprint\Validators\Rules\Regex; -use JBZoo\CsvBlueprint\Validators\Rules\UsaMarketName; +use JBZoo\CsvBlueprint\Rules\AllowValues; +use JBZoo\CsvBlueprint\Rules\CardinalDirection; +use JBZoo\CsvBlueprint\Rules\DateFormat; +use JBZoo\CsvBlueprint\Rules\ExactValue; +use JBZoo\CsvBlueprint\Rules\IsBool; +use JBZoo\CsvBlueprint\Rules\IsDomain; +use JBZoo\CsvBlueprint\Rules\IsEmail; +use JBZoo\CsvBlueprint\Rules\IsFloat; +use JBZoo\CsvBlueprint\Rules\IsInt; +use JBZoo\CsvBlueprint\Rules\IsIp; +use JBZoo\CsvBlueprint\Rules\IsLatitude; +use JBZoo\CsvBlueprint\Rules\IsLongitude; +use JBZoo\CsvBlueprint\Rules\IsUrl; +use JBZoo\CsvBlueprint\Rules\IsUuid4; +use JBZoo\CsvBlueprint\Rules\Max; +use JBZoo\CsvBlueprint\Rules\MaxDate; +use JBZoo\CsvBlueprint\Rules\MaxLength; +use JBZoo\CsvBlueprint\Rules\Min; +use JBZoo\CsvBlueprint\Rules\MinDate; +use JBZoo\CsvBlueprint\Rules\MinLength; +use JBZoo\CsvBlueprint\Rules\NotEmpty; +use JBZoo\CsvBlueprint\Rules\OnlyCapitalize; +use JBZoo\CsvBlueprint\Rules\OnlyLowercase; +use JBZoo\CsvBlueprint\Rules\OnlyUppercase; +use JBZoo\CsvBlueprint\Rules\Precision; +use JBZoo\CsvBlueprint\Rules\Regex; +use JBZoo\CsvBlueprint\Rules\UsaMarketName; use JBZoo\PHPUnit\PHPUnit; use JBZoo\Utils\Str; diff --git a/tests/Blueprint/ValidatorTest.php b/tests/Blueprint/ValidatorTest.php index 4c6a0ffa..e57f125e 100644 --- a/tests/Blueprint/ValidatorTest.php +++ b/tests/Blueprint/ValidatorTest.php @@ -43,7 +43,7 @@ protected function setUp(): void public function testUndefinedRule(): void { $this->expectExceptionMessage( - 'Rule "undefined_rule" not found. Expected class: "JBZoo\CsvBlueprint\Validators\Rules\UndefinedRule"', + 'Rule "undefined_rule" not found. Expected class: "\JBZoo\CsvBlueprint\Rules\UndefinedRule"', ); $csv = new CsvFile(self::CSV_COMPLEX, $this->getRule('seq', 'undefined_rule', true)); $csv->validate();