File tree Expand file tree Collapse file tree 1 file changed +76
-0
lines changed
tests/DependencyInjection Expand file tree Collapse file tree 1 file changed +76
-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 \SymfonyConfigTest \PhpUnit \ConfigurationTestCaseTrait ;
8+ use PHPUnit \Framework \TestCase ;
9+ use Symfony \Component \Config \Definition \ConfigurationInterface ;
10+
11+ class ConfigurationTest extends TestCase
12+ {
13+
14+ use ConfigurationTestCaseTrait;
15+
16+ public function testEmptyConfigurationIsValid (): void
17+ {
18+ $ this ->assertConfigurationIsValid (
19+ [
20+ [], // no values at all
21+ ]
22+ );
23+ }
24+
25+ public function testEnabledConfigurationIsValid (): void
26+ {
27+ $ this ->assertConfigurationIsValid (
28+ [
29+ [
30+ 'enabled ' => true ,
31+ ],
32+ ]
33+ );
34+ }
35+
36+ public function testDisabledConfigurationIsValid (): void
37+ {
38+ $ this ->assertConfigurationIsValid (
39+ [
40+ [
41+ 'enabled ' => false ,
42+ ],
43+ ]
44+ );
45+ }
46+
47+ public function testEnabledConfigurationIsValidXX (): void
48+ {
49+ $ this ->assertConfigurationIsInvalid (
50+ [
51+ [
52+ 'enabled ' => 1 ,
53+ ],
54+ ],
55+ 'Invalid type for path "java_script_error_handler.enabled". Expected boolean, but got integer. '
56+ );
57+ }
58+
59+ public function testInvalidConfigurationIsInvalid (): void
60+ {
61+ $ this ->assertConfigurationIsInvalid (
62+ [
63+ [
64+ 'invalid_option ' => 1 ,
65+ ],
66+ ],
67+ 'Unrecognized option "invalid_option" under "java_script_error_handler" '
68+ );
69+ }
70+
71+ protected function getConfiguration (): ConfigurationInterface
72+ {
73+ return new Configuration (true );
74+ }
75+
76+ }
You can’t perform that action at this time.
0 commit comments