dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
run.php
Go to the documentation of this file.
1<?php
2require_once dirname(__DIR__) . '/include/dbxSelfTestRunner.class.php';
3
5
6$profile = 'full';
7$requested = array();
8$json = false;
9foreach (array_slice($argv ?? array(), 1) as $argument) {
10 if ($argument === '--quick' || $argument === '--profile=quick') $profile = 'quick';
11 if ($argument === '--json') $json = true;
12 if (str_starts_with($argument, '--test=')) $requested[] = substr($argument, 7);
13}
14
15$runner = new dbxSelfTestRunner();
16$run = $runner->runProfile($profile, $requested, static function (array $result, ?array $current) use ($json): void {
17 if ($json) return;
18 $total = (int)($current['totals']['total'] ?? 0);
19 $done = (int)($current['totals']['completed'] ?? 0);
20 $label = strtoupper((string)$result['status']);
21 fwrite(STDOUT, sprintf("[%d/%d] %-7s %s (%s)\n", $done, $total, $label, $result['name'], $result['duration_ms'] . ' ms'));
22 if (($result['status'] ?? '') === 'failed') {
23 fwrite(STDOUT, ' ' . str_replace("\n", "\n ", (string)$result['summary']) . "\n");
24 }
25});
26
27if ($json) {
28 echo json_encode($run, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL;
29} else {
30 $totals = $run['totals'];
31 fwrite(STDOUT, sprintf(
32 "\nSelf-Test %s: %d bestanden, %d fehlgeschlagen, %d uebersprungen. Protokoll: %s\n",
33 strtoupper((string)$run['status']),
34 $totals['passed'],
35 $totals['failed'],
36 $totals['skipped'],
37 $runner->runLogPath((string)$run['id'])
38 ));
39}
40exit(($run['status'] ?? '') === 'passed' ? 0 : 1);
Zentraler, auch ohne Web-Kernel nutzbarer Test-Orchestrator.
exit
Definition index.php:146
foreach(array_slice($argv ?? array(), 1) as $argument) $runner
Definition run.php:15
$profile
Definition run.php:6
$requested
Definition run.php:7