-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuutg
57 lines (46 loc) · 1.46 KB
/
uutg
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
#!/usr/bin/env php
<?php
/**
* Ultimate Unit Test Generator (Uutg)
*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* that is bundled with this package in the file LICENSE.txt
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @license http://opensource.org/licenses/mit-license.php MIT License
* @author Marius Strajeru
*/
declare(strict_types=1);
if (php_sapi_name() !== "cli") {
exit('Test generator can be executed from cli only');
}
if (isset($GLOBALS['_composer_autoload_path'])) {
define('UUTG_COMPOSER_INSTALL', $GLOBALS['_composer_autoload_path']);
unset($GLOBALS['_composer_autoload_path']);
} else {
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('UUTG_COMPOSER_INSTALL', $file);
break;
}
}
unset($file);
}
if (!defined('UUTG_COMPOSER_INSTALL')) {
die("Cannot find autoload file\n");
}
require UUTG_COMPOSER_INSTALL;
$options = getopt("", ["class:", "config::"]);
$configFile = $options['config'] ?? __DIR__.'/./uutg.php.dist';
if (!file_exists($configFile)) {
exit(sprintf("Config file '%s' does not exist\n", $configFile));
}
$config = new \Umc\Uutg\Config(include $configFile);
$app = new \Umc\Uutg\Uutg(
$config,
$options['class'] ?? null
);
exit($app->run() . "\n");