aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository/path_repository_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-06 03:46:41 +0900
committernsfisis <nsfisis@gmail.com>2026-08-06 03:46:41 +0900
commit92d2199afcecd0056e82d2559700769715401ef0 (patch)
treeb9d65620db53bc19f800247660e560f3f8775217 /crates/shirabe/tests/repository/path_repository_test.rs
parent27e81d5e5ca0a89eb176a65b1d9f186658b16f50 (diff)
downloadphp-shirabe-92d2199afcecd0056e82d2559700769715401ef0.tar.gz
php-shirabe-92d2199afcecd0056e82d2559700769715401ef0.tar.zst
php-shirabe-92d2199afcecd0056e82d2559700769715401ef0.zip
refactor(php-shim): take filesystem paths as impl AsRef<Path>
The shim's filesystem entry points took `&str` even though each one resolves to a local path through `std::fs` or a syscall, so callers holding a `PathBuf` had to stringify it at the call site. They now take `impl AsRef<Path>`, the form `file_exists`, `is_dir`, `unlink` and the rest of the already-converted set use. `Phar`, `PharData` and `ZipArchive` keep their archive path as a `PathBuf`. `PharData::compress` names the compressed sibling by appending the suffix to the file name rather than formatting the path into a `String`. Arguments PHP resolves through a stream wrapper (`fopen`, `file_put_contents`, `include`) still take `&str`, as do the byte-string operations (`dirname`, `basename`, `pathinfo`) and archive-internal entry names, which are `/`-joined logical names rather than OS paths. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository/path_repository_test.rs')
-rw-r--r--crates/shirabe/tests/repository/path_repository_test.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/tests/repository/path_repository_test.rs b/crates/shirabe/tests/repository/path_repository_test.rs
index 24bf64d5..0631e7f7 100644
--- a/crates/shirabe/tests/repository/path_repository_test.rs
+++ b/crates/shirabe/tests/repository/path_repository_test.rs
@@ -201,7 +201,7 @@ fn test_url_remains_relative() {
// realpath() does not fully expand the paths
// PHP Bug https://bugs.php.net/bug.php?id=72642
let repository_url = [
- realpath(&realpath(&fixtures_dir().replace("/Fixtures", "")).unwrap_or_default())
+ realpath(realpath(fixtures_dir().replace("/Fixtures", "")).unwrap_or_default())
.unwrap_or_default(),
"Fixtures".to_string(),
"path".to_string(),
@@ -210,7 +210,7 @@ fn test_url_remains_relative() {
.join(DIRECTORY_SEPARATOR);
// getcwd() not necessarily match __DIR__
// PHP Bug https://bugs.php.net/bug.php?id=73797
- let cwd = realpath(&realpath(&Platform::get_cwd(false).unwrap()).unwrap_or_default())
+ let cwd = realpath(realpath(Platform::get_cwd(false).unwrap()).unwrap_or_default())
.unwrap_or_default();
let relative_url = repository_url[cwd.len().min(repository_url.len())..]
.trim_start_matches(DIRECTORY_SEPARATOR)