-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpController.php
More file actions
66 lines (59 loc) · 3.17 KB
/
HelpController.php
File metadata and controls
66 lines (59 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace MaplePHP\Unitary\Console\Controllers;
use MaplePHP\Prompts\Themes\Blocks;
class HelpController extends DefaultController
{
/**
* Main help page
*
* @return void
*/
public function index(): void
{
$blocks = new Blocks($this->command);
$blocks->addHeadline("\n--- Unitary Help ---");
$blocks->addSection("Usage", "php vendor/bin/unitary [type] [options]");
$blocks->addSection("Options", function (Blocks $inst) {
return $inst
->addOption("--help", "Display this help message.")
->addOption("--show=<hash|name>", "Run a specific test by hash or test name.")
->addOption("--errors-only", "Show only failing tests, hide passed ones.")
->addOption("--path=<path>", "Set test path (absolute or relative).")
->addOption("--exclude=<patterns>", "Exclude files or directories (comma-separated, relative to --path).")
->addOption("--discover-pattern", "Override test discovery pattern (`tests/` directories or default: `unitary-*.php` files).")
->addOption("--smart-search", "If no tests are found in a subdirectory, Unitary will traverse down to locate tests automatically.")
->addOption("--type", "default (cli), junit or xml")
->addOption("--always-show-files", "Always display full test file paths, even for passing tests.")
->addOption("--timezone=<region/city>", "Set default timezone (e.g. `Europe/Stockholm`). Affects date handling.")
->addOption("--locale=<locale>", "Set default locale (e.g. `en_US`). Affects date formatting.")
->addOption("--verbose", "Show all warnings, including hidden ones.")
->addOption("--fail-fast", "Stop immediately on the first error or exception.");
});
$blocks->addSection("Type list", function (Blocks $inst) {
return $inst
->addOption("run", "Run all Unitary tests")
->addOption("template", "Show template/boilerplate Unitary test code")
->addOption("coverage", "Show code coverage and how much code is used")
->addOption("audit", "Audit vulnerabilities and dependencies");
});
$blocks->addSection("Some examples", function (Blocks $inst) {
return $inst
->addExamples(
"php vendor/bin/unitary",
"Run all unitary tests"
)->addExamples(
"php vendor/bin/unitary run",
"Run all unitary tests"
)->addExamples(
"php vendor/bin/unitary --show=b0620ca8ef6ea7598e5ed56a530b1983",
"Run the test with a specific hash ID"
)->addExamples(
"php vendor/bin/unitary --show=YourNameHere",
"Run a manually named test case"
)->addExamples(
'php vendor/bin/unitary --path="tests/" --exclude="tests/legacy/*,*/extras/*"',
'Run all tests under "tests/" excluding specified directories'
);
});
}
}