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

Function test_classmap_basic_vendor_entries

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

Source from the content-addressed store, hash-verified

661
662#[test]
663fn test_classmap_basic_vendor_entries() {
664 let ws = TestWorkspace::new(r#"{"name": "test/project"}"#);
665
666 let classmap_content = concat!(
667 "<?php\n",
668 "\n",
669 "// autoload_classmap.php @generated by Composer\n",
670 "\n",
671 "$vendorDir = dirname(__DIR__);\n",
672 "$baseDir = dirname($vendorDir);\n",
673 "\n",
674 "return array(\n",
675 " 'AWS\\\\CRT\\\\Auth\\\\AwsCredentials' => $vendorDir . '/aws/aws-crt-php/src/AWS/CRT/Auth/AwsCredentials.php',\n",
676 " 'AWS\\\\CRT\\\\Auth\\\\CredentialsProvider' => $vendorDir . '/aws/aws-crt-php/src/AWS/CRT/Auth/CredentialsProvider.php',\n",
677 ");\n",
678 );
679 ws.create_php_file("vendor/composer/autoload_classmap.php", classmap_content);
680
681 let classmap = parse_autoload_classmap(ws.root(), "vendor");
682 assert_eq!(classmap.len(), 2, "Should find 2 classmap entries");
683
684 let creds_path = classmap.get("AWS\\CRT\\Auth\\AwsCredentials");
685 assert!(creds_path.is_some(), "Should have AwsCredentials entry");
686 assert!(
687 creds_path
688 .unwrap()
689 .ends_with("vendor/aws/aws-crt-php/src/AWS/CRT/Auth/AwsCredentials.php"),
690 "AwsCredentials path should resolve to vendor dir, got: {:?}",
691 creds_path
692 );
693
694 let provider_path = classmap.get("AWS\\CRT\\Auth\\CredentialsProvider");
695 assert!(
696 provider_path.is_some(),
697 "Should have CredentialsProvider entry"
698 );
699 assert!(
700 provider_path
701 .unwrap()
702 .ends_with("vendor/aws/aws-crt-php/src/AWS/CRT/Auth/CredentialsProvider.php"),
703 "CredentialsProvider path should resolve to vendor dir, got: {:?}",
704 provider_path
705 );
706}
707
708#[test]
709fn test_classmap_basedir_entries() {

Callers

nothing calls this directly

Calls 4

parse_autoload_classmapFunction · 0.85
create_php_fileMethod · 0.80
rootMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected