Skip to content

Commit 49d9790

Browse files
committed
ConfigurationTest
1 parent 7e46bf5 commit 49d9790

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
}

0 commit comments

Comments
 (0)