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

Function rename_class_from_declaration

src/rename/tests.rs:315–344  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

313
314#[tokio::test]
315async fn rename_class_from_declaration() {
316 let backend = Backend::new_test();
317 let uri = Url::parse("file:///test.php").unwrap();
318 let text = concat!(
319 "<?php\n",
320 "class Widget {\n",
321 " public function render(): string { return ''; }\n",
322 "}\n",
323 "function demo(Widget $w): void {\n",
324 " $obj = new Widget();\n",
325 "}\n",
326 );
327
328 open_file(&backend, &uri, text).await;
329
330 // Rename from the declaration site (line 1).
331 let edit = rename(&backend, &uri, 1, 7, "Component").await;
332 assert!(edit.is_some());
333
334 let file_edits = edits_for_uri(&edit.unwrap(), &uri);
335 assert!(
336 file_edits.len() >= 3,
337 "Expected at least 3 edits for Widget, got {}",
338 file_edits.len()
339 );
340
341 for te in &file_edits {
342 assert_eq!(te.new_text, "Component");
343 }
344}
345
346#[tokio::test]
347async fn prepare_rename_class() {

Callers

nothing calls this directly

Calls 4

renameFunction · 0.85
edits_for_uriFunction · 0.85
open_fileFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected