CoreInitializationPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 19 2
1
<?php
2
3
namespace SilverStripe\BehatExtension\Compiler;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8
/**
9
 * Loads SilverStripe core. Required to initialize autoloading.
10
 */
11
class CoreInitializationPass implements CompilerPassInterface
12
{
13
    /**
14
     * Loads kernel file.
15
     *
16
     * @param ContainerBuilder $container
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        // Connect to database and build manifest
21
        $frameworkPath = $container->getParameter('behat.silverstripe_extension.framework_path');
22
        $_GET['flush'] = 1;
23
        require_once $frameworkPath . '/core/Core.php';
24
        
25
        if (class_exists('TestRunner')) {
26
            // 3.x compat
27
            \TestRunner::use_test_manifest();
28
        } else {
29
            \SapphireTest::use_test_manifest();
30
        }
31
32
        unset($_GET['flush']);
33
34
        // Remove the error handler so that PHPUnit can add its own
35
        restore_error_handler();
36
    }
37
}
38