-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests_and_log.php
More file actions
40 lines (34 loc) · 1.06 KB
/
Copy pathrun_tests_and_log.php
File metadata and controls
40 lines (34 loc) · 1.06 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
<?php
echo "Starting test execution...\n";
$options = getopt('', ['format:']);
$format = $options['format'] ?? 'text';
$logFile = __DIR__.'/test_results';
$pestCommand = __DIR__.'/vendor/bin/pest';
switch ($format) {
case 'junit':
$logFile .= '.xml';
$pestCommand .= " --log-junit $logFile";
break;
case 'testdox-html':
$logFile .= '.html';
$pestCommand .= " --testdox-html $logFile";
break;
case 'testdox-text':
$logFile .= '.txt';
$pestCommand .= " --testdox-text $logFile";
break;
case 'teamcity':
$logFile .= '.teamcity.txt';
$pestCommand .= " --log-teamcity $logFile";
break;
case 'text':
default:
$logFile .= '.log';
$output = shell_exec($pestCommand);
file_put_contents($logFile, $output);
echo 'Test execution finished. Log file should be at: '.$logFile."\n";
exit(0);
}
echo "Running command: $pestCommand\n";
shell_exec($pestCommand);
echo 'Test execution finished. Log file should be at: '.$logFile."\n";