File tree Expand file tree Collapse file tree 4 files changed +53
-2
lines changed
Expand file tree Collapse file tree 4 files changed +53
-2
lines changed Original file line number Diff line number Diff line change 11._ *
22.DS_Store
3- .sass-cache
3+ .sass-cache
4+ composer.lock
5+ vendor
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ public function __construct(mixed $value)
5252 $ this ->dateTime = new DateTime ("now " );
5353 if (is_string ($ value ) || is_numeric ($ value )) {
5454 $ this ->length = $ this ->getLength ($ value );
55+ $ this ->getStr = new Str ($ this ->value );
5556 }
56- $ this ->getStr = new Str ((string )$ this ->value );
5757 }
5858
5959 /**
Original file line number Diff line number Diff line change 1818 "require" : {
1919 "php" : " >=8.0" ,
2020 "maplephp/dto" : " ^1.0"
21+ },
22+ "require-dev" : {
23+ "maplephp/unitary" : " ^1.0"
24+ },
25+ "replace" : {
26+ "maplephp/validate" : " self.version"
2127 },
2228 "autoload" : {
2329 "psr-4" : {
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+ <?php
3+ /**
4+ * This is how a template test file should look like but
5+ * when used in MaplePHP framework you can skip the "bash code" at top and the "autoload file"!
6+ */
7+ use MaplePHP \Unitary \Unit ;
8+
9+ if (!class_exists (Unit::class)) {
10+ $ dir = realpath (dirname (__FILE__ )."/.. " );
11+ if (is_file ("$ dir/vendor/autoload.php " )) {
12+ require_once ("$ dir/vendor/autoload.php " );
13+ } else {
14+ die ("Please run 'composer install' before running the example test suite " );
15+ }
16+ }
17+
18+ // If you add true to Unit it will run in quite mode
19+ // and only report if it finds any errors!
20+ $ unit = new Unit (true );
21+
22+ // Add a title to your tests (not required)
23+ $ unit ->addTitle ("Testing MaplePHP Unitary library! " );
24+ $ unit ->add ("Checking data type " , function ($ inst ) {
25+
26+ $ inst ->add ("Lorem ipsum dolor " , [
27+ "string " => [],
28+ "length " => [1 ,200 ]
29+
30+ ])->add (92928 , [
31+ "int " => []
32+
33+ ])->add ("Lorem " , [
34+ "string " => [],
35+ "length " => function ($ valid ) {
36+ return $ valid ->length (1 , 50 );
37+ }
38+ ], "The length is not correct! " );
39+
40+ });
41+
42+ $ unit ->execute ();
43+
You can’t perform that action at this time.
0 commit comments