()
| 2469 | |
| 2470 | #[test] |
| 2471 | fn symbols_mixed_file() { |
| 2472 | let content = br#"<?php |
| 2473 | namespace App\Utils; |
| 2474 | |
| 2475 | class Helper {} |
| 2476 | interface Renderable {} |
| 2477 | |
| 2478 | function formatDate(): string { return ''; } |
| 2479 | function parseJson(): array { return []; } |
| 2480 | |
| 2481 | define('APP_NAME', 'MyApp'); |
| 2482 | const DEBUG = true; |
| 2483 | "#; |
| 2484 | let result = find_symbols(content); |
| 2485 | assert_eq!( |
| 2486 | result.classes, |
| 2487 | vec!["App\\Utils\\Helper", "App\\Utils\\Renderable"] |
| 2488 | ); |
| 2489 | assert_eq!( |
| 2490 | result.functions, |
| 2491 | vec!["App\\Utils\\formatDate", "App\\Utils\\parseJson"] |
| 2492 | ); |
| 2493 | assert!( |
| 2494 | result.constants.contains(&"APP_NAME".to_string()), |
| 2495 | "should find define(): {:?}", |
| 2496 | result.constants |
| 2497 | ); |
| 2498 | assert!( |
| 2499 | result.constants.contains(&"App\\Utils\\DEBUG".to_string()), |
| 2500 | "should find namespaced const: {:?}", |
| 2501 | result.constants |
| 2502 | ); |
| 2503 | } |
| 2504 | |
| 2505 | #[test] |
| 2506 | fn symbols_function_in_comment_ignored() { |
nothing calls this directly
no test coverage detected