Skip to content

Commit 546e600

Browse files
Merge pull request #3 from MaplePHP/develop
Fix title and path
2 parents cc1e0e2 + 68307cf commit 546e600

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Unit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Unit
1313
const PATTERN = 'unitary-*.php';
1414
private Command $command;
1515
private bool $quite;
16-
private ?string $title;
16+
private ?string $title = null;
1717
private array $args = [];
1818
private array $units;
1919
private int $index = 0;
@@ -90,7 +90,7 @@ public function add(string $message, callable $callback): void
9090
*/
9191
public function execute(): void
9292
{
93-
if(!is_null($this->title) && !$this->quite || count($this->error) > 0) {
93+
if(!is_null($this->title) && (!$this->quite || count($this->error) > 0)) {
9494
$this->command->title("\n--------- $this->title ---------");
9595
}
9696
if(count($this->error) > 0) {
@@ -147,7 +147,7 @@ private function findFiles($dir): array
147147
$files = [];
148148
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
149149
foreach ($iterator as $file) {
150-
if (fnmatch(static::PATTERN, $file->getFilename())) {
150+
if(isset($this->args['path']) || strpos($file->getPathname(), "vendor/") === false) {
151151
$files[] = $file->getPathname();
152152
}
153153
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": ">=8.0",
2020
"maplephp/dto": "^1.0",
2121
"maplephp/http": "^1.0",
22-
"maplephp/validate": "^1.0",
22+
"maplephp/validate": "^1.0.0",
2323
"maplephp/prompts": "^1.0"
2424
},
2525
"autoload": {

tools/unitary

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use MaplePHP\Unitary\Unit;
88

99
if (!class_exists(Unit::class)) {
1010
$dir = realpath(__DIR__ . "/../../../");
11-
$alFile = (defined("UNITARY_AUTOLOAD_FILE") ? UNITARY_AUTOLOAD_FILE : "$dir/vendor/autoload.php");
11+
$alFile = (defined("UNITARY_AUTOLOAD_FILE") ? UNITARY_AUTOLOAD_FILE : "$dir/autoload.php");
1212
if (is_file($alFile)) {
1313
require_once($alFile);
1414
} else {
@@ -24,15 +24,15 @@ $request = new ServerRequest(new Uri($env->getUriParts([
2424
])), $env);
2525

2626
$data = $request->getCliArgs();
27-
$defaultPath = (defined("UNITARY_PATH") ? UNITARY_PATH : null);
27+
$defaultPath = (defined("UNITARY_PATH") ? UNITARY_PATH : "./");
2828

2929
try {
3030
$path = ($data['path'] ?? $defaultPath);
3131
if(!isset($path)) {
3232
throw new Exception("Path not specified: --path=path/to/dir");
3333
}
3434

35-
$testDir = realpath($data['path']);
35+
$testDir = realpath($path);
3636
if(!is_dir($testDir)) {
3737
throw new Exception("Test directory '$testDir' does not exist");
3838
}

0 commit comments

Comments
 (0)