|
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 testLogs() |
|
56
|
|
|
{ |
|
57
|
|
|
$this->load(['log_logs' => true]); |
|
58
|
|
|
|
|
59
|
|
|
$this->assertContainerBuilderHasParameter('ekino.new_relic.log_logs'); |
|
60
|
|
|
$this->assertContainerBuilderHasService('ekino.new_relic.logs_handler'); |
|
61
|
|
|
$this->assertContainerBuilderHasServiceDefinitionWithArgument('ekino.new_relic.logs_handler', 0, 400); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|