Completed
Push — master ( 3e7ede...b510d1 )
by Jérémy
14s queued 11s
created

EkinoNewRelicExtensionTest::testLogs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Ekino New Relic bundle.
7
 *
8
 * (c) Ekino - Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Bundle\NewRelicBundle\Tests\DependencyInjection;
15
16
use Ekino\Bundle\NewRelicBundle\DependencyInjection\EkinoNewRelicExtension;
17
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
18
19
class EkinoNewRelicExtensionTest extends AbstractExtensionTestCase
20
{
21
    protected function getContainerExtensions()
22
    {
23
        return [new EkinoNewRelicExtension()];
24
    }
25
26
    protected function setUp()
27
    {
28
        parent::setUp();
29
30
        $this->setParameter('kernel.bundles', []);
31
    }
32
33
    public function testDefaultConfiguration()
34
    {
35
        $this->load();
36
37
        $this->assertContainerBuilderHasService('ekino.new_relic.twig.new_relic_extension');
38
        $this->assertContainerBuilderHasService('ekino.new_relic.command_listener');
39
        $this->assertContainerBuilderNotHasService('ekino.new_relic.exception_listener');
40
    }
41
42
    public function testAlternativeConfiguration()
43
    {
44
        $this->load([
45
            'log_exceptions' => true,
46
            'log_commands' => false,
47
            'twig' => false,
48
        ]);
49
50
        $this->assertContainerBuilderNotHasService('ekino.new_relic.twig.new_relic_extension');
51
        $this->assertContainerBuilderNotHasService('ekino.new_relic.command_listener');
52
        $this->assertContainerBuilderHasService('ekino.new_relic.exception_listener');
53
    }
54
55
    public function testDeprecation()
56
    {
57
        $this->load();
58
59
        $this->assertContainerBuilderHasParameter('ekino.new_relic.log_deprecations');
60
    }
61
62
    public function testLogs()
63
    {
64
        $this->load(['log_logs' => true]);
65
66
        $this->assertContainerBuilderHasParameter('ekino.new_relic.log_logs');
67
        $this->assertContainerBuilderHasService('ekino.new_relic.logs_handler');
68
        $this->assertContainerBuilderHasServiceDefinitionWithArgument('ekino.new_relic.logs_handler', 0, 400);
69
    }
70
}
71