Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
._*
.DS_Store
.sass-cache
.sass-cache
composer.lock
vendor
2 changes: 1 addition & 1 deletion Inp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
43 changes: 43 additions & 0 deletions tests/unitary-test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
/**
* This is how a template test file should look like but
* when used in MaplePHP framework you can skip the "bash code" at top and the "autoload file"!
*/
use MaplePHP\Unitary\Unit;

if (!class_exists(Unit::class)) {
$dir = realpath(dirname(__FILE__)."/..");
if(is_file("$dir/vendor/autoload.php")) {
require_once("$dir/vendor/autoload.php");
} else {
die("Please run 'composer install' before running the example test suite");
}
}

// If you add true to Unit it will run in quite mode
// and only report if it finds any errors!
$unit = new Unit(true);

// Add a title to your tests (not required)
$unit->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();