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

Function test_blade_references

tests/integration/blade.rs:197–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195
196 #[tokio::test]
197 async fn test_blade_references() {
198 let backend = create_test_backend();
199
200 let php_uri = Url::parse("file:///Logger.php").unwrap();
201 let php_text = "<?php class Logger { public function info() {} }";
202 backend
203 .did_open(DidOpenTextDocumentParams {
204 text_document: TextDocumentItem {
205 uri: php_uri.clone(),
206 language_id: "php".to_string(),
207 version: 1,
208 text: php_text.to_string(),
209 },
210 })
211 .await;
212
213 let blade_uri = Url::parse("file:///view.blade.php").unwrap();
214 let blade_text = "@php $l = new Logger(); @endphp\n{{ $l->info() }}";
215
216 backend
217 .did_open(DidOpenTextDocumentParams {
218 text_document: TextDocumentItem {
219 uri: blade_uri.clone(),
220 language_id: "blade".to_string(),
221 version: 1,
222 text: blade_text.to_string(),
223 },
224 })
225 .await;
226
227 let params = ReferenceParams {
228 text_document_position: TextDocumentPositionParams {
229 text_document: TextDocumentIdentifier {
230 uri: php_uri.clone(),
231 },
232 position: Position {
233 line: 0,
234 character: 37, // info
235 },
236 },
237 work_done_progress_params: WorkDoneProgressParams::default(),
238 partial_result_params: PartialResultParams::default(),
239 context: ReferenceContext {
240 include_declaration: true,
241 },
242 };
243
244 let result = backend.references(params).await.unwrap();
245 assert!(result.is_some());
246 let locations = result.unwrap();
247
248 assert!(
249 locations.iter().any(|l| l.uri == blade_uri),
250 "Should find reference in Blade file"
251 );
252 }
253
254 #[tokio::test]

Callers

nothing calls this directly

Calls 5

create_test_backendFunction · 0.85
cloneMethod · 0.80
referencesMethod · 0.80
unwrapMethod · 0.45
did_openMethod · 0.45

Tested by

no test coverage detected