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

Function test_method_references_same_file

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

Source from the content-addressed store, hash-verified

220
221#[tokio::test]
222async fn test_method_references_same_file() {
223 let backend = Backend::new_test();
224 let uri = Url::parse("file:///test.php").unwrap();
225 let text = concat!(
226 "<?php\n", // L0
227 "class Repo {\n", // L1
228 " public function find(int $id): void {}\n", // L2
229 "}\n", // L3
230 "class Controller {\n", // L4
231 " public function index(Repo $r): void {\n", // L5
232 " $r->find(1);\n", // L6
233 " $r->find(2);\n", // L7
234 " }\n", // L8
235 "}\n", // L9
236 );
237
238 open_file(&backend, &uri, text).await;
239
240 // Click on "find" at line 6 (method call).
241 let locs = find_references(&backend, &uri, 6, 14, false).await;
242 // Should find at least 2 call sites (L6, L7).
243 assert!(
244 locs.len() >= 2,
245 "Expected at least 2 references to find(), got {}",
246 locs.len()
247 );
248}
249
250#[tokio::test]
251async fn test_method_references_include_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