diff --git a/.gitignore b/.gitignore index e9ec7e7..c66fb76 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ ._* .DS_Store -.sass-cache \ No newline at end of file +.sass-cache +composer.lock +vendor \ No newline at end of file diff --git a/Inp.php b/Inp.php index f5e0fd3..e921ec3 100755 --- a/Inp.php +++ b/Inp.php @@ -52,8 +52,8 @@ public function __construct(mixed $value) $this->dateTime = new DateTime("now"); if(is_string($value) || is_numeric($value)) { $this->length = $this->getLength($value); + $this->getStr = new Str($this->value); } - $this->getStr = new Str((string)$this->value); } /** diff --git a/composer.json b/composer.json index 178a805..6b2d120 100755 --- a/composer.json +++ b/composer.json @@ -18,6 +18,12 @@ "require": { "php": ">=8.0", "maplephp/dto": "^1.0" + }, + "require-dev": { + "maplephp/unitary": "^1.0" + }, + "replace": { + "maplephp/validate": "self.version" }, "autoload": { "psr-4": { diff --git a/tests/unitary-test.php b/tests/unitary-test.php new file mode 100755 index 0000000..6e7872c --- /dev/null +++ b/tests/unitary-test.php @@ -0,0 +1,43 @@ +#!/usr/bin/env php +addTitle("Testing MaplePHP Unitary library!"); +$unit->add("Checking data type", function($inst) { + + $inst->add("Lorem ipsum dolor", [ + "string" => [], + "length" => [1,200] + + ])->add(92928, [ + "int" => [] + + ])->add("Lorem", [ + "string" => [], + "length" => function($valid) { + return $valid->length(1, 50); + } + ], "The length is not correct!"); + +}); + +$unit->execute(); +