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

Function test_resolve_simple_class

tests/unit/composer.rs:131–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129
130#[test]
131fn test_resolve_simple_class() {
132 let ws = TestWorkspace::new(
133 r#"{
134 "autoload": {
135 "psr-4": {
136 "Klarna\\": "src/Klarna/"
137 }
138 }
139 }"#,
140 );
141 ws.create_php_file(
142 "src/Klarna/Customer.php",
143 "<?php\nnamespace Klarna;\nclass Customer {}\n",
144 );
145
146 let (mappings, _vendor_dir) = parse_composer_json(ws.root());
147 let result = resolve_class_path(&mappings, ws.root(), "Klarna\\Customer");
148
149 assert!(result.is_some());
150 let path = result.unwrap();
151 assert!(path.ends_with("src/Klarna/Customer.php"));
152}
153
154#[test]
155fn test_resolve_nested_namespace() {

Callers

nothing calls this directly

Calls 5

parse_composer_jsonFunction · 0.85
resolve_class_pathFunction · 0.85
create_php_fileMethod · 0.80
rootMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected