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

Function rename_class_constant

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

Source from the content-addressed store, hash-verified

524
525#[tokio::test]
526async fn rename_class_constant() {
527 let backend = Backend::new_test();
528 let uri = Url::parse("file:///test.php").unwrap();
529 let text = concat!(
530 "<?php\n",
531 "class Status {\n",
532 " const ACTIVE = 1;\n",
533 "}\n",
534 "function demo(): void {\n",
535 " echo Status::ACTIVE;\n",
536 " $x = Status::ACTIVE;\n",
537 "}\n",
538 );
539
540 open_file(&backend, &uri, text).await;
541
542 let edit = rename(&backend, &uri, 5, 19, "ENABLED").await;
543 assert!(
544 edit.is_some(),
545 "Expected a workspace edit for constant rename"
546 );
547
548 let file_edits = edits_for_uri(&edit.unwrap(), &uri);
549 assert!(
550 file_edits.len() >= 3,
551 "Expected at least 3 edits for ACTIVE, got {}",
552 file_edits.len()
553 );
554
555 for te in &file_edits {
556 assert_eq!(te.new_text, "ENABLED");
557 }
558}
559
560// ─── Cross-file Rename ─────────────────────────────────────────────────────
561

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