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

Function test_variable_references_same_scope

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

Source from the content-addressed store, hash-verified

46
47#[tokio::test]
48async fn test_variable_references_same_scope() {
49 let backend = Backend::new_test();
50 let uri = Url::parse("file:///test.php").unwrap();
51 let text = concat!(
52 "<?php\n", // L0
53 "function demo(): void {\n", // L1
54 " $user = new User();\n", // L2
55 " $user->name = 'Alice';\n", // L3
56 " echo $user->name;\n", // L4
57 "}\n", // L5
58 );
59
60 open_file(&backend, &uri, text).await;
61
62 // Click on $user at line 3
63 let locs = find_references(&backend, &uri, 3, 5, true).await;
64 assert!(
65 locs.len() >= 3,
66 "Expected at least 3 references to $user, got {}",
67 locs.len()
68 );
69 // All references should be in the same file.
70 for loc in &locs {
71 assert_eq!(loc.uri, uri);
72 }
73}
74
75#[tokio::test]
76async fn test_variable_references_excludes_other_scope() {

Callers

nothing calls this directly

Calls 3

find_referencesFunction · 0.85
open_fileFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected