()
| 259 | |
| 260 | #[test] |
| 261 | fn include_inside_method_body() { |
| 262 | let dir = tempfile::tempdir().unwrap(); |
| 263 | let target = dir.path().join("routes.php"); |
| 264 | fs::write(&target, "<?php // routes").unwrap(); |
| 265 | |
| 266 | let main_content = format!( |
| 267 | "<?php\nclass App {{\n public function boot(): void {{\n require_once '{}';\n }}\n}}\n", |
| 268 | target.to_string_lossy() |
| 269 | ); |
| 270 | let main_uri = format!("file://{}", dir.path().join("main.php").to_string_lossy()); |
| 271 | |
| 272 | let backend = create_test_backend(); |
| 273 | let links = get_document_links(&backend, &main_uri, &main_content); |
| 274 | |
| 275 | assert_eq!( |
| 276 | links.len(), |
| 277 | 1, |
| 278 | "Expected include inside method body, got: {:?}", |
| 279 | link_targets(&links) |
| 280 | ); |
| 281 | } |
| 282 | |
| 283 | #[test] |
| 284 | fn include_inside_if_statement() { |
nothing calls this directly
no test coverage detected