LoadTrait::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 9.424
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SfCod\QueueBundle\Tests\Data;
4
5
use Monolog\Logger;
6
use Psr\Container\ContainerInterface;
7
use Psr\Log\LoggerInterface;
8
use SfCod\QueueBundle\DependencyInjection\QueueExtension;
9
use SfCod\QueueBundle\Service\MongoDriver;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
12
/**
13
 * Trait LoadTrait
14
 *
15
 * @package SfCod\QueueBundle\Tests\Data
16
 */
17
trait LoadTrait
18
{
19
    /**
20
     * @var ContainerInterface
21
     */
22
    protected $container;
23
24
    /**
25
     * Configure container
26
     *
27
     * @throws \ReflectionException
28
     */
29
    protected function configure()
30
    {
31
        $extension = new QueueExtension();
32
        $container = new ContainerBuilder();
33
        $container->setParameter('kernel.project_dir', '');
34
        $container->setParameter('kernel.environment', 'prod');
35
        $container->setParameter('kernel.root_dir', realpath(__DIR__ . '/../../../../SfCod/'));
36
        $container->set(LoggerInterface::class, new Logger('test'));
37
38
        $extension->load([
39
            0 => [
40
                'namespaces' => [
41
                    'SfCod\QueueBundle\Tests\Data',
42
                ],
43
            ],
44
            1 => [
45
                'connections' => [
46
                    'default' => [
47
                        'driver' => 'mongo-thread',
48
                        'collection' => 'queue_jobs',
49
                        'connection' => MongoDriver::class,
50
                        'queue' => 'default',
51
                        'expire' => 60,
52
                        'limit' => 2,
53
                    ],
54
                ],
55
            ],
56
        ], $container);
57
58
        $this->container = $container;
59
    }
60
}
61