Completed
Push — ezp26970-login_no_siteaccess_l... ( 42bede...99b8e7 )
by
unknown
22:52 queued 11:39
created

SetupFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B getServiceContainer() 0 29 2
1
<?php
2
3
/**
4
 * File containing the Test Setup Factory base class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Repository\Tests\Service\Integration\Legacy;
10
11
use eZ\Publish\Core\Base\ServiceContainer;
12
use eZ\Publish\API\Repository\Tests\SetupFactory\Legacy as APILegacySetupFactory;
13
14
/**
15
 * A Test Factory is used to setup the infrastructure for a tests, based on a
16
 * specific repository implementation to test.
17
 */
18
class SetupFactory extends APILegacySetupFactory
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $repositoryReference = 'ezpublish.api.inner_repository';
24
25
    /**
26
     * Returns the service container used for initialization of the repository.
27
     *
28
     * @return \eZ\Publish\Core\Base\ServiceContainer
29
     */
30
    public function getServiceContainer()
31
    {
32
        if (!isset(static::$serviceContainer)) {
33
            $config = include __DIR__ . '/../../../../../../../../config.php';
34
            $installDir = $config['install_dir'];
35
36
            /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder */
37
            $containerBuilder = include $config['container_builder_path'];
38
39
            /* @var \Symfony\Component\DependencyInjection\Loader\YamlFileLoader $loader */
40
            $loader->load('search_engines/legacy.yml');
0 ignored issues
show
Bug introduced by
The variable $loader does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
41
            $loader->load('tests/integration_legacy_core.yml');
42
43
            $containerBuilder->setParameter(
44
                'legacy_dsn',
45
                static::$dsn
46
            );
47
48
            static::$serviceContainer = new ServiceContainer(
49
                $containerBuilder,
50
                $installDir,
51
                $config['cache_dir'],
52
                true,
53
                true
54
            );
55
        }
56
57
        return static::$serviceContainer;
58
    }
59
}
60