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

Function class_references_no_duplicates

tests/integration/references.rs:132–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130
131#[test]
132fn class_references_no_duplicates() {
133 let backend = create_test_backend();
134 let uri = "file:///tmp/test_refs_class.php";
135 let content = r#"<?php
136
137class Foo {
138 public function bar(): void {}
139}
140
141class Baz {
142 public function test(): void {
143 $f = new Foo();
144 $g = new Foo();
145 }
146}
147"#;
148
149 open_file(&backend, uri, content);
150
151 // Cursor on `Foo` in the class declaration (line 2, col 6)
152 let results = backend
153 .find_references(uri, content, Position::new(2, 6), true)
154 .expect("should find references");
155
156 assert_no_duplicates(&results, "class_references");
157
158 // We expect exactly 3: the declaration + 2 usages in `new Foo()`
159 assert_eq!(
160 results.len(),
161 3,
162 "Expected 3 references (1 declaration + 2 usages), got {}: {:#?}",
163 results.len(),
164 results
165 );
166}
167
168#[test]
169fn class_references_without_declaration_no_duplicates() {

Callers

nothing calls this directly

Calls 4

create_test_backendFunction · 0.85
assert_no_duplicatesFunction · 0.85
find_referencesMethod · 0.80
open_fileFunction · 0.70

Tested by

no test coverage detected