()
| 369 | |
| 370 | #[tokio::test] |
| 371 | async fn rename_method() { |
| 372 | let backend = Backend::new_test(); |
| 373 | let uri = Url::parse("file:///test.php").unwrap(); |
| 374 | let text = concat!( |
| 375 | "<?php\n", |
| 376 | "class Service {\n", |
| 377 | " public function process(): void {}\n", |
| 378 | "}\n", |
| 379 | "function demo(): void {\n", |
| 380 | " $s = new Service();\n", |
| 381 | " $s->process();\n", |
| 382 | " $s->process();\n", |
| 383 | "}\n", |
| 384 | ); |
| 385 | |
| 386 | open_file(&backend, &uri, text).await; |
| 387 | |
| 388 | // Rename from call site (line 6). |
| 389 | let edit = rename(&backend, &uri, 6, 9, "execute").await; |
| 390 | assert!( |
| 391 | edit.is_some(), |
| 392 | "Expected a workspace edit for method rename" |
| 393 | ); |
| 394 | |
| 395 | let file_edits = edits_for_uri(&edit.unwrap(), &uri); |
| 396 | // Should find: declaration (L2) + 2 call sites (L6, L7) = at least 3. |
| 397 | assert!( |
| 398 | file_edits.len() >= 3, |
| 399 | "Expected at least 3 edits for process, got {}", |
| 400 | file_edits.len() |
| 401 | ); |
| 402 | |
| 403 | for te in &file_edits { |
| 404 | assert_eq!(te.new_text, "execute"); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | #[tokio::test] |
| 409 | async fn rename_static_method() { |
nothing calls this directly
no test coverage detected