Bootstrap   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 7 1
A resolveRoot() 0 7 3
1
<?php
2
/**
3
 * Webino (http://webino.sk/)
4
 *
5
 * @link        https://github.com/webino/WebinoDev/ for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2017 Webino, s. r. o. (http://webino.sk/)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDev\Tester;
11
12
use Tester\Environment;
13
14
/**
15
 * Nette tester bootstrap
16
 */
17
class Bootstrap
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $dir;
23
24
    /**
25
     * @param string $dir
26
     */
27
    public function __construct($dir)
28
    {
29
        $this->dir = (string)$dir;
30
    }
31
32
    /**
33
     * Setup tester environment
34
     */
35
    public function __invoke()
36
    {
37
        chdir($this->resolveRoot());
38
        Environment::setup();
39
        ini_set('date.timezone', 'Europe/Bratislava');
40
        error_reporting((E_ALL | E_STRICT) & ~E_USER_DEPRECATED);
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    protected function resolveRoot()
47
    {
48
        $dir  = $this->dir . '/../../._test/';
49
        $zend = $dir . 'ZendSkeletonApplication';
50
        $root = file_exists($zend) ? $zend : $dir . 'WebinoSkeletonApplication';
51
        return file_exists($root) ? $root : $this->dir;
52
    }
53
}
54