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

Function require_once_dir_concat

tests/integration/document_links.rs:114–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112
113#[test]
114fn 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]
140fn require_once_dirname_dir() {

Callers

nothing calls this directly

Calls 3

create_test_backendFunction · 0.85
get_document_linksFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected