MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / test_class_references_same_file

Function test_class_references_same_file

src/references/tests.rs:134–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132
133#[tokio::test]
134async fn test_class_references_same_file() {
135 let backend = Backend::new_test();
136 let uri = Url::parse("file:///test.php").unwrap();
137 let text = concat!(
138 "<?php\n", // L0
139 "class Logger {\n", // L1
140 " public function info(): void {}\n", // L2
141 "}\n", // L3
142 "class Service {\n", // L4
143 " public function run(Logger $l): void {\n", // L5
144 " $x = new Logger();\n", // L6
145 " }\n", // L7
146 "}\n", // L8
147 );
148
149 open_file(&backend, &uri, text).await;
150
151 // Click on "Logger" on line 5 (type hint).
152 let locs = find_references(&backend, &uri, 5, 27, true).await;
153 // Should find: declaration (L1), type hint (L5), new (L6) = at least 3.
154 assert!(
155 locs.len() >= 2,
156 "Expected at least 2 references to Logger, got {}",
157 locs.len()
158 );
159}
160
161#[tokio::test]
162async fn test_class_references_exclude_declaration() {

Callers

nothing calls this directly

Calls 3

find_referencesFunction · 0.85
open_fileFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected