-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.php
61 lines (49 loc) · 1.42 KB
/
run-tests.php
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
<?php
if (!file_exists('vendor/autoload.php')) {
echo "Please run 'composer install' first\n";
exit(1);
}
require 'vendor/autoload.php';
require 'config.php';
require 'helpers.php';
use Src\TestsRunner;
use Src\TestsParser;
use Src\ParallelTesting;
use Src\Response;
use Src\ResultsContainer;
use Src\Webhook;
use Src\HtmlReport;
ini_set("memory_limit", MEMORY_LIMIT ?? '512M');
ini_set('max_execution_time', MAX_EXECUTION_TIME ?? '300');
set_exception_handler(function ($e) {
echo $e->getMessage();
exit(1);
});
$testFiles = (new TestsParser())->getTestFiles();
/**
* Run tests in parallel
* /usr/bin/php run-tests.php --parallel tests/ExampleTest.php
*/
if(PARALLEL_TESTS) {
if(count($argv) == 3 && $argv[1] === '--parallel') { // Run single test in parallel
$testRunner = new TestsRunner();
$testRunner->run([$argv[2]]);
} else {
ResultsContainer::initialize();
$parallelTesting = new ParallelTesting(); // Execute tests in parallel
$parallelTesting->run($testFiles);
(new Response())->handle();
(new HtmlReport())->generate();
(new Webhook())->send();
}
return;
}
/**
* Run tests sequentially
*/
ResultsContainer::initialize();
$testRunner = new TestsRunner();
$testRunner->run($testFiles);
(new Response())->handle();
(new HtmlReport())->generate();
(new Webhook())->send();