()
| 112 | |
| 113 | #[test] |
| 114 | fn require_once_dir_concat() { |
| 115 | let dir = tempfile::tempdir().unwrap(); |
| 116 | let target_file = dir.path().join("bootstrap.php"); |
| 117 | fs::write(&target_file, "<?php // bootstrap").unwrap(); |
| 118 | |
| 119 | let main_content = "<?php\nrequire_once __DIR__ . '/bootstrap.php';\n"; |
| 120 | let main_uri = format!("file://{}", dir.path().join("main.php").to_string_lossy()); |
| 121 | |
| 122 | let backend = create_test_backend(); |
| 123 | let links = get_document_links(&backend, &main_uri, main_content); |
| 124 | |
| 125 | assert_eq!( |
| 126 | links.len(), |
| 127 | 1, |
| 128 | "Expected one __DIR__ concat link, got: {:?}", |
| 129 | link_targets(&links) |
| 130 | ); |
| 131 | let target = links[0].target.as_ref().unwrap(); |
| 132 | assert!( |
| 133 | target.to_file_path().unwrap().ends_with("bootstrap.php"), |
| 134 | "Expected link to bootstrap.php, got: {}", |
| 135 | target |
| 136 | ); |
| 137 | } |
| 138 | |
| 139 | #[test] |
| 140 | fn require_once_dirname_dir() { |
nothing calls this directly
no test coverage detected