UnitTestsBootstrap   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrapSystem() 0 5 1
A enableDisplayErrors() 0 6 1
A initializeConfiguration() 0 7 1
1
<?php
2
/**
3
 * T3Bot.
4
 *
5
 * @author Frank Nägler <[email protected]>
6
 *
7
 * @link http://www.t3bot.de
8
 * @link http://wiki.typo3.org/T3Bot
9
 */
10
class UnitTestsBootstrap
11
{
12
    /**
13
     * Bootstraps the system for unit tests.
14
     */
15
    public function bootstrapSystem()
16
    {
17
        $this->enableDisplayErrors()
18
            ->initializeConfiguration();
19
    }
20
21
    /**
22
     * Makes sure error messages during the tests get displayed no matter what is set in php.ini.
23
     *
24
     * @return UnitTestsBootstrap fluent interface
25
     */
26
    protected function enableDisplayErrors()
27
    {
28
        @ini_set('display_errors', 1);
29
30
        return $this;
31
    }
32
33
    /**
34
     * Provides the default configuration.
35
     *
36
     * @return UnitTestsBootstrap fluent interface
37
     */
38
    protected function initializeConfiguration()
39
    {
40
        include __DIR__.'/../vendor/autoload.php';
41
        include __DIR__.'/../config/config.php';
42
43
        return $this;
44
    }
45
}
46
47
if (PHP_SAPI !== 'cli') {
48
    die('This script supports command line usage only. Please check your command.');
49
}
50
$bootstrap = new UnitTestsBootstrap();
51
$bootstrap->bootstrapSystem();
52
unset($bootstrap);
53