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

Function rename_function

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

Source from the content-addressed store, hash-verified

488
489#[tokio::test]
490async fn rename_function() {
491 let backend = Backend::new_test();
492 let uri = Url::parse("file:///test.php").unwrap();
493 let text = concat!(
494 "<?php\n",
495 "function helper(): void {}\n",
496 "function demo(): void {\n",
497 " helper();\n",
498 " helper();\n",
499 "}\n",
500 );
501
502 open_file(&backend, &uri, text).await;
503
504 let edit = rename(&backend, &uri, 3, 6, "utility").await;
505 assert!(
506 edit.is_some(),
507 "Expected a workspace edit for function rename"
508 );
509
510 let file_edits = edits_for_uri(&edit.unwrap(), &uri);
511 // declaration (L1) + 2 call sites (L3, L4) = at least 3.
512 assert!(
513 file_edits.len() >= 3,
514 "Expected at least 3 edits for helper, got {}",
515 file_edits.len()
516 );
517
518 for te in &file_edits {
519 assert_eq!(te.new_text, "utility");
520 }
521}
522
523// ─── Constant Rename ────────────────────────────────────────────────────────
524

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