@@ -23,7 +23,91 @@ public function testHoverForClassLike()
23
23
], $ reference ->range ), $ result );
24
24
}
25
25
26
- public function testHoverWithoutDocBlock ()
26
+ public function testHoverForMethod ()
27
+ {
28
+ // $obj->testMethod();
29
+ // Get hover for testMethod
30
+ $ reference = $ this ->getReferenceLocations ('TestClass::testMethod() ' )[0 ];
31
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
32
+ $ this ->assertEquals (new Hover ([
33
+ new MarkedString ('php ' , "<?php \npublic function testMethod( \$testParameter) " ),
34
+ 'Non culpa nostrud mollit esse sunt laboris in irure ullamco cupidatat amet. '
35
+ ], $ reference ->range ), $ result );
36
+ }
37
+
38
+ public function testHoverForProperty ()
39
+ {
40
+ // echo $obj->testProperty;
41
+ // Get hover for testProperty
42
+ $ reference = $ this ->getReferenceLocations ('TestClass::testProperty ' )[0 ];
43
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
44
+ $ this ->assertEquals (new Hover ([
45
+ new MarkedString ('php ' , "<?php \npublic \$testProperty; " ),
46
+ 'Reprehenderit magna velit mollit ipsum do. '
47
+ ], $ reference ->range ), $ result );
48
+ }
49
+
50
+ public function testHoverForStaticMethod ()
51
+ {
52
+ // TestClass::staticTestMethod();
53
+ // Get hover for staticTestMethod
54
+ $ reference = $ this ->getReferenceLocations ('TestClass::staticTestMethod() ' )[0 ];
55
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
56
+ $ this ->assertEquals (new Hover ([
57
+ new MarkedString ('php ' , "<?php \npublic static function staticTestMethod() " ),
58
+ 'Do magna consequat veniam minim proident eiusmod incididunt aute proident. '
59
+ ], $ reference ->range ), $ result );
60
+ }
61
+
62
+ public function testHoverForStaticProperty ()
63
+ {
64
+ // echo TestClass::staticTestProperty;
65
+ // Get hover for staticTestProperty
66
+ $ reference = $ this ->getReferenceLocations ('TestClass::staticTestProperty ' )[0 ];
67
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
68
+ $ this ->assertEquals (new Hover ([
69
+ new MarkedString ('php ' , "<?php \npublic static \$staticTestProperty; " ),
70
+ 'Lorem excepteur officia sit anim velit veniam enim. '
71
+ ], $ reference ->range ), $ result );
72
+ }
73
+
74
+ public function testHoverForClassConstant ()
75
+ {
76
+ // echo TestClass::TEST_CLASS_CONST;
77
+ // Get hover for TEST_CLASS_CONST
78
+ $ reference = $ this ->getReferenceLocations ('TestClass::TEST_CLASS_CONST ' )[0 ];
79
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
80
+ $ this ->assertEquals (new Hover ([
81
+ new MarkedString ('php ' , "<?php \nconst TEST_CLASS_CONST = 123; " ),
82
+ 'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad. '
83
+ ], $ reference ->range ), $ result );
84
+ }
85
+
86
+ public function testHoverForFunction ()
87
+ {
88
+ // test_function();
89
+ // Get hover for test_function
90
+ $ reference = $ this ->getReferenceLocations ('test_function() ' )[0 ];
91
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
92
+ $ this ->assertEquals (new Hover ([
93
+ new MarkedString ('php ' , "<?php \nfunction test_function() " ),
94
+ 'Officia aliquip adipisicing et nulla et laboris dolore labore. '
95
+ ], $ reference ->range ), $ result );
96
+ }
97
+
98
+ public function testHoverForConstant ()
99
+ {
100
+ // echo TEST_CONST;
101
+ // Get hover for TEST_CONST
102
+ $ reference = $ this ->getReferenceLocations ('TEST_CONST ' )[0 ];
103
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ reference ->uri ), $ reference ->range ->end );
104
+ $ this ->assertEquals (new Hover ([
105
+ new MarkedString ('php ' , "<?php \nconst TEST_CONST = 123; " ),
106
+ 'Esse commodo excepteur pariatur Lorem est aute incididunt reprehenderit. '
107
+ ], $ reference ->range ), $ result );
108
+ }
109
+
110
+ public function testHoverForVariable ()
27
111
{
28
112
// echo $var;
29
113
// Get hover for $var
@@ -34,4 +118,19 @@ public function testHoverWithoutDocBlock()
34
118
new Range (new Position (13 , 5 ), new Position (13 , 9 ))
35
119
), $ result );
36
120
}
121
+
122
+ public function testHoverForParam ()
123
+ {
124
+ // echo $param;
125
+ // Get hover for $param
126
+ $ uri = pathToUri (realpath (__DIR__ . '/../../../fixtures/references.php ' ));
127
+ $ result = $ this ->textDocument ->hover (new TextDocumentIdentifier ($ uri ), new Position (22 , 11 ));
128
+ $ this ->assertEquals (new Hover (
129
+ [
130
+ new MarkedString ('php ' , "<?php \n\TestNamespace\TestClass \$param " ),
131
+ 'Adipisicing non non cillum sint incididunt cillum enim mollit. '
132
+ ],
133
+ new Range (new Position (22 , 9 ), new Position (22 , 15 ))
134
+ ), $ result );
135
+ }
37
136
}
0 commit comments