()
| 875 | |
| 876 | #[test] |
| 877 | fn strategy_custom_bin_dir() { |
| 878 | let dir = tempfile::tempdir().unwrap(); |
| 879 | let custom_bin = dir.path().join("bin"); |
| 880 | std::fs::create_dir_all(&custom_bin).unwrap(); |
| 881 | |
| 882 | let p = custom_bin.join("php-cs-fixer"); |
| 883 | std::fs::write(&p, "#!/bin/sh\n").unwrap(); |
| 884 | #[cfg(unix)] |
| 885 | { |
| 886 | use std::os::unix::fs::PermissionsExt; |
| 887 | std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o755)).unwrap(); |
| 888 | } |
| 889 | |
| 890 | let composer: crate::composer::ComposerPackage = |
| 891 | serde_json::from_value(serde_json::json!({ |
| 892 | "require-dev": { |
| 893 | "friendsofphp/php-cs-fixer": "^3.0" |
| 894 | } |
| 895 | })) |
| 896 | .unwrap(); |
| 897 | |
| 898 | let config = FormattingConfig::default(); |
| 899 | let strategy = resolve_strategy(Some(dir.path()), &config, Some(&composer), Some("bin")); |
| 900 | match &strategy { |
| 901 | FormattingStrategy::External(tools) => { |
| 902 | assert_eq!(tools.len(), 1); |
| 903 | assert_eq!(tools[0].path, custom_bin.join("php-cs-fixer")); |
| 904 | } |
| 905 | other => panic!("Expected External, got {:?}", other), |
| 906 | } |
| 907 | } |
| 908 | |
| 909 | #[test] |
| 910 | fn strategy_custom_bin_dir_ignores_default_vendor_bin() { |
nothing calls this directly
no test coverage detected