File tree 2 files changed +54
-0
lines changed
PHPSemVerChecker/Configuration
2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace PHPSemVerChecker \Test \Configuration ;
4
+
5
+ use PHPSemVerChecker \Configuration \Configuration ;
6
+ use PHPSemVerChecker \SemanticVersioning \Level ;
7
+ use PHPUnit_Framework_TestCase ;
8
+
9
+ class ConfigurationTest extends PHPUnit_Framework_TestCase
10
+ {
11
+ /**
12
+ * @var \PHPSemVerChecker\Configuration\Configuration
13
+ */
14
+ protected $ config ;
15
+
16
+ public function setUp ()
17
+ {
18
+ $ this ->config = new Configuration ([__DIR__ .'/../../fixtures/configuration/php-semver-checker.json ' ]);
19
+ }
20
+
21
+ public function testGet ()
22
+ {
23
+ $ this ->assertEquals ('src ' , $ this ->config ->get ('include-before ' ));
24
+ }
25
+
26
+ public function testGetDefault ()
27
+ {
28
+ $ this ->assertEquals ('default ' , $ this ->config ->get ('missing key ' , 'default ' ));
29
+ }
30
+
31
+ public function testSet ()
32
+ {
33
+ $ unique = new \stdClass ();
34
+ $ this ->config ->set ('any key ' , $ unique );
35
+ $ this ->assertEquals ($ unique , $ this ->config ->get ('any key ' ));
36
+ }
37
+
38
+ public function testGetLevelMapping (){
39
+ $ levelMapping = $ this ->config ->getLevelMapping ();
40
+ $ this ->assertTrue (is_array ($ levelMapping ));
41
+ $ this ->assertEquals ($ levelMapping ['V001 ' ], Level::PATCH );
42
+ $ this ->assertEquals ($ levelMapping ['V006 ' ], Level::MAJOR );
43
+ }
44
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "include-before" : " src" ,
3
+ "include-after" : " src" ,
4
+ "level" : {
5
+ "mapping" : {
6
+ "V001" : " PATCH" ,
7
+ "V006" : " MAJOR"
8
+ }
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments