/
phpunit_bootstrap.php
66 lines (54 loc) · 1.57 KB
/
phpunit_bootstrap.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
62
63
64
65
66
<?php
/*
* This file is part of the BlendEngine framework.
*
* (c) Gevik Babakhani <gevikb@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'Europe/Amsterdam');
}
foreach (array(__DIR__.'/../../autoload.php', __DIR__.'/../vendor/autoload.php', __DIR__.'/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('BLEND_COMPOSER_INSTALL', $file);
break;
}
}
unset($file);
if (!defined('BLEND_COMPOSER_INSTALL')) {
fwrite(STDERR, 'You need to set up the project dependencies using the following commands:'.PHP_EOL.
'wget http://getcomposer.org/composer.phar'.PHP_EOL.
'php composer.phar install'.PHP_EOL
);
die(1);
}
if (!function_exists('is_windows')) {
function is_windows()
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}
}
if (!function_exists('catch_output')) {
function catch_output(callable $callback)
{
ob_start();
ob_implicit_flush(false);
call_user_func($callback);
return ob_get_clean();
}
}
if (!function_exists('measure_time')) {
function measure_time(callable $callback)
{
$start = microtime(true);
return array(call_user_func($callback), (microtime(true) - $start));
}
}
$tempFolder = dirname(__FILE__).'/temp';
if (!file_exists($tempFolder)) {
mkdir($tempFolder, 0777, true);
}
define('TEMP_DIR', $tempFolder);
require BLEND_COMPOSER_INSTALL;