Commit 689bb5f 1 parent 6fa66db commit 689bb5f Copy full SHA for 689bb5f
File tree 1 file changed +62
-0
lines changed
tests/DependencyInjection
1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types = 1 );
4
+
5
+ namespace Mhujer \JavaScriptErrorHandlerBundle \DependencyInjection ;
6
+
7
+ use Matthias \SymfonyDependencyInjectionTest \PhpUnit \AbstractExtensionTestCase ;
8
+ use Mhujer \JavaScriptErrorHandlerBundle \EventListener \JsErrorToAlertListener ;
9
+
10
+ class JavaScriptErrorHandlerExtensionTest extends AbstractExtensionTestCase
11
+ {
12
+
13
+ private const LISTENER_CLASS_NAME = JsErrorToAlertListener::class;
14
+
15
+ protected function getContainerExtensions ()
16
+ {
17
+ return [
18
+ new JavaScriptErrorHandlerExtension (),
19
+ ];
20
+ }
21
+
22
+ public function testListenerIsRegisteredInDebugMode (): void
23
+ {
24
+ $ this ->container ->setParameter ('kernel.debug ' , true );
25
+
26
+ $ this ->load ();
27
+
28
+ $ this ->assertContainerBuilderHasService (self ::LISTENER_CLASS_NAME );
29
+ }
30
+
31
+ public function testListenerIsNotRegisteredWithoutDebugMode (): void
32
+ {
33
+ $ this ->container ->setParameter ('kernel.debug ' , false );
34
+
35
+ $ this ->load ();
36
+
37
+ $ this ->assertContainerBuilderNotHasService (self ::LISTENER_CLASS_NAME );
38
+ }
39
+
40
+ public function testKernelDebugCanBeOverriddenToDisable (): void
41
+ {
42
+ $ this ->container ->setParameter ('kernel.debug ' , true );
43
+
44
+ $ this ->load ([
45
+ 'enabled ' => false ,
46
+ ]);
47
+
48
+ $ this ->assertContainerBuilderNotHasService (self ::LISTENER_CLASS_NAME );
49
+ }
50
+
51
+ public function testKernelDebugCanBeOverriddenToEnable (): void
52
+ {
53
+ $ this ->container ->setParameter ('kernel.debug ' , false );
54
+
55
+ $ this ->load ([
56
+ 'enabled ' => true ,
57
+ ]);
58
+
59
+ $ this ->assertContainerBuilderHasService (self ::LISTENER_CLASS_NAME );
60
+ }
61
+
62
+ }
You can’t perform that action at this time.
0 commit comments