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

Function rename_variable_without_dollar_prefix

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

Source from the content-addressed store, hash-verified

137
138#[tokio::test]
139async fn rename_variable_without_dollar_prefix() {
140 let backend = Backend::new_test();
141 let uri = Url::parse("file:///test.php").unwrap();
142 let text = concat!(
143 "<?php\n",
144 "function demo(): void {\n",
145 " $x = 1;\n",
146 " echo $x;\n",
147 "}\n",
148 );
149
150 open_file(&backend, &uri, text).await;
151
152 // User provides new name without `$` — the handler should add it.
153 let edit = rename(&backend, &uri, 2, 5, "y").await;
154 assert!(edit.is_some());
155
156 let file_edits = edits_for_uri(&edit.unwrap(), &uri);
157 for te in &file_edits {
158 assert_eq!(te.new_text, "$y");
159 }
160}
161
162#[tokio::test]
163async fn prepare_rename_variable() {

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