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

Function test_parse_php_static_method

tests/integration/parser.rs:307–330  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305
306#[tokio::test]
307async fn test_parse_php_static_method() {
308 let backend = create_test_backend();
309 let php = concat!(
310 "<?php\n",
311 "class Factory {\n",
312 " public static function create(string $type): self {}\n",
313 " public function build(): void {}\n",
314 "}\n",
315 );
316
317 let classes = backend.parse_php(php);
318 assert_eq!(classes.len(), 1);
319 assert_eq!(classes[0].methods.len(), 2);
320
321 let create = &classes[0].methods[0];
322 assert_eq!(create.name, "create");
323 assert!(create.is_static, "create should be static");
324 assert_eq!(create.parameters.len(), 1);
325 assert_eq!(create.parameters[0].name, "$type");
326
327 let build = &classes[0].methods[1];
328 assert_eq!(build.name, "build");
329 assert!(!build.is_static, "build should not be static");
330}
331
332#[tokio::test]
333async fn test_parse_php_extracts_constants() {

Callers

nothing calls this directly

Calls 2

create_test_backendFunction · 0.85
parse_phpMethod · 0.80

Tested by

no test coverage detected