5
5
6
6
class JsonPointerTest extends \PHPUnit \Framework \TestCase
7
7
{
8
- public function encodeDecodeData ()
8
+ public static function encodeDecodeData ()
9
9
{
10
10
return [
11
11
['~0 ' , '~ ' ],
@@ -41,7 +41,7 @@ public function testDecode($encoded, $decoded)
41
41
/**
42
42
* @link https://tools.ietf.org/html/rfc6901#section-5
43
43
*/
44
- public function rfcJsonDocument ()
44
+ public static function rfcJsonDocument ()
45
45
{
46
46
return <<<JSON
47
47
{
@@ -63,10 +63,10 @@ public function rfcJsonDocument()
63
63
/**
64
64
* @link https://tools.ietf.org/html/rfc6901#section-5
65
65
*/
66
- public function rfcExamples ()
66
+ public static function rfcExamples ()
67
67
{
68
68
$ return = [
69
- ["" , "# " , json_decode ($ this -> rfcJsonDocument ())],
69
+ ["" , "# " , json_decode (self :: rfcJsonDocument ())],
70
70
["/foo " , "#/foo " , ["bar " , "baz " ]],
71
71
["/foo/0 " , "#/foo/0 " , "bar " ],
72
72
["/ " , "#/ " , 0 ],
@@ -80,14 +80,14 @@ public function rfcExamples()
80
80
["/m~0n " , "#/m~0n " , 8 ],
81
81
];
82
82
foreach ($ return as $ example ) {
83
- $ example [3 ] = $ this -> rfcJsonDocument ();
83
+ $ example [3 ] = self :: rfcJsonDocument ();
84
84
yield $ example ;
85
85
}
86
86
}
87
87
88
- public function allExamples ()
88
+ public static function allExamples ()
89
89
{
90
- yield from $ this -> rfcExamples ();
90
+ yield from self :: rfcExamples ();
91
91
92
92
yield ["/a#b " , "#/a%23b " , 16 , '{"a#b": 16} ' ];
93
93
}
@@ -117,11 +117,11 @@ public function testUriEncoding($jsonPointer, $uriJsonPointer, $expectedEvaluati
117
117
*/
118
118
public function testEvaluation ($ jsonPointer , $ uriJsonPointer , $ expectedEvaluation )
119
119
{
120
- $ document = json_decode ($ this -> rfcJsonDocument ());
120
+ $ document = json_decode (self :: rfcJsonDocument ());
121
121
$ pointer = new JsonPointer ($ jsonPointer );
122
122
$ this ->assertEquals ($ expectedEvaluation , $ pointer ->evaluate ($ document ));
123
123
124
- $ document = json_decode ($ this -> rfcJsonDocument ());
124
+ $ document = json_decode (self :: rfcJsonDocument ());
125
125
$ reference = JsonReference::createFromReference ($ uriJsonPointer );
126
126
$ this ->assertEquals ($ expectedEvaluation , $ reference ->getJsonPointer ()->evaluate ($ document ));
127
127
}
0 commit comments