File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ public function testParse()
59
59
$ this ->assertSame ('/*value*/ ' , $ parsed ['a//b ' ]);
60
60
}
61
61
62
+ public function testParseFromFile ()
63
+ {
64
+ $ parsed = Comment::parseFromFile (__DIR__ . '/composer.json ' , true );
65
+
66
+ $ this ->assertTrue (is_array ($ parsed ));
67
+ $ this ->assertSame ('adhocore/json-comment ' , $ parsed ['name ' ]);
68
+ }
69
+
62
70
public function theTests ()
63
71
{
64
72
return [
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " adhocore/json-comment" ,
3
+ "description" : " Lightweight JSON comment stripper library for PHP" ,
4
+ "type" :/* This is creepy comment */ "library",
5
+ "keywords" : [
6
+ " json" ,
7
+ " comment" ,
8
+ // Single line comment, Notice the comma below:
9
+ " strip-comment" ,
10
+ ],
11
+ "license" : " MIT" ,
12
+ /*
13
+ * This is multiline comment
14
+ */
15
+ "authors" : [
16
+ {
17
+ "name" : " Jitendra Adhikari" ,
18
+
19
+ },
20
+ ],
21
+ "autoload" : {
22
+ "psr-4" : {
23
+ "Ahc\\ Json\\ " : " src/" ,
24
+ },
25
+ },
26
+ "autoload-dev" : {
27
+ "psr-4" : {
28
+ "Ahc\\ Json\\ Test\\ " : " tests/" ,
29
+ },
30
+ },
31
+ "require" : {
32
+ "php" : " >=7.0" ,
33
+ "ext-ctype" : " *" ,
34
+ },
35
+ "require-dev" : {
36
+ "phpunit/phpunit" : " ^6.5 || ^7.5 || ^8.5" ,
37
+ },
38
+ "scripts" : {
39
+ "test" : " phpunit" ,
40
+ "echo" : " echo '// This is not comment'" ,
41
+ "test:cov" : " phpunit --coverage-text --coverage-clover coverage.xml" ,
42
+ },
43
+ }
You can’t perform that action at this time.
0 commit comments