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\NewRelicBundle\Tests\DependencyInjection; |
||
15 | |||
16 | use Ekino\NewRelicBundle\DependencyInjection\EkinoNewRelicExtension; |
||
17 | use Ekino\NewRelicBundle\Listener\CommandListener; |
||
18 | use Ekino\NewRelicBundle\Listener\DeprecationListener; |
||
19 | use Ekino\NewRelicBundle\Listener\ExceptionListener; |
||
20 | use Ekino\NewRelicBundle\NewRelic\BlackholeInteractor; |
||
21 | use Ekino\NewRelicBundle\NewRelic\NewRelicInteractorInterface; |
||
22 | use Ekino\NewRelicBundle\Twig\NewRelicExtension; |
||
23 | use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; |
||
24 | use Matthias\SymfonyDependencyInjectionTest\PhpUnit\ContainerHasParameterConstraint; |
||
25 | use PHPUnit\Framework\Constraint\LogicalNot; |
||
0 ignored issues
–
show
|
|||
26 | |||
27 | class EkinoNewRelicExtensionTest extends AbstractExtensionTestCase |
||
28 | { |
||
29 | protected function getContainerExtensions(): array |
||
30 | { |
||
31 | return [new EkinoNewRelicExtension()]; |
||
32 | } |
||
33 | |||
34 | protected function setUp(): void |
||
35 | { |
||
36 | parent::setUp(); |
||
37 | |||
38 | $this->setParameter('kernel.bundles', []); |
||
39 | } |
||
40 | |||
41 | public function testDefaultConfiguration() |
||
42 | { |
||
43 | $this->load(); |
||
44 | |||
45 | $this->assertContainerBuilderHasService(NewRelicExtension::class); |
||
46 | $this->assertContainerBuilderHasService(CommandListener::class); |
||
47 | $this->assertContainerBuilderHasService(ExceptionListener::class); |
||
48 | } |
||
49 | |||
50 | public function testAlternativeConfiguration() |
||
51 | { |
||
52 | $this->load([ |
||
53 | 'exceptions' => false, |
||
54 | 'commands' => false, |
||
55 | 'twig' => false, |
||
56 | ]); |
||
57 | |||
58 | $this->assertContainerBuilderNotHasService(NewRelicExtension::class); |
||
59 | $this->assertContainerBuilderNotHasService(CommandListener::class); |
||
60 | $this->assertContainerBuilderNotHasService(ExceptionListener::class); |
||
61 | } |
||
62 | |||
63 | public function testDeprecation() |
||
64 | { |
||
65 | $this->load(); |
||
66 | |||
67 | $this->assertContainerBuilderHasService(DeprecationListener::class); |
||
68 | } |
||
69 | |||
70 | public function testMonolog() |
||
71 | { |
||
72 | $this->load(['monolog' => true]); |
||
73 | |||
74 | $this->assertContainerBuilderHasParameter('ekino.new_relic.monolog'); |
||
75 | $this->assertContainerBuilderHasParameter('ekino.new_relic.application_name'); |
||
76 | $this->assertContainerBuilderHasService('ekino.new_relic.logs_handler'); |
||
77 | } |
||
78 | |||
79 | public function testMonologDisabled() |
||
80 | { |
||
81 | $this->load(['monolog' => false]); |
||
82 | |||
83 | self::assertThat( |
||
84 | $this->container, |
||
85 | new LogicalNot(new ContainerHasParameterConstraint('ekino.new_relic.monolog', null, false)) |
||
86 | ); |
||
87 | } |
||
88 | |||
89 | public function testConfigDisabled() |
||
90 | { |
||
91 | $this->load([ |
||
92 | 'enabled' => false, |
||
93 | ]); |
||
94 | |||
95 | $this->assertContainerBuilderHasAlias(NewRelicInteractorInterface::class, BlackholeInteractor::class); |
||
96 | } |
||
97 | |||
98 | public function testConfigDisabledWithInteractor() |
||
99 | { |
||
100 | $this->load([ |
||
101 | 'enabled' => false, |
||
102 | 'interactor' => 'ekino.new_relic.interactor.adaptive', |
||
103 | ]); |
||
104 | |||
105 | $this->assertContainerBuilderHasAlias(NewRelicInteractorInterface::class, BlackholeInteractor::class); |
||
106 | } |
||
107 | |||
108 | public function testConfigEnabledWithInteractor() |
||
109 | { |
||
110 | $this->load([ |
||
111 | 'enabled' => true, |
||
112 | 'interactor' => 'ekino.new_relic.interactor.adaptive', |
||
113 | ]); |
||
114 | |||
115 | $this->assertContainerBuilderHasAlias(NewRelicInteractorInterface::class, 'ekino.new_relic.interactor.adaptive'); |
||
116 | } |
||
117 | } |
||
118 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths