Skip to content

Commit 2316ed2

Browse files
committed
refactor: update phpvm_current test to handle additional exit codes and version formats
1 parent bda71b5 commit 2316ed2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/01_core.bats

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ load test_helper
7878

7979
@test "phpvm current shows no active version initially" {
8080
run phpvm_current
81-
# Accept either "none" (no PHP) or "system" (system PHP exists)
82-
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
83-
[[ "$output" = "none" ]] || [[ "$output" = "system" ]]
81+
# Accept: 0 (managed PHP), 4 (none/not installed), or output "system"
82+
# Exit code 4 = PHPVM_EXIT_NOT_INSTALLED (when no PHP found)
83+
[ "$status" -eq 0 ] || [ "$status" -eq 4 ]
84+
[[ "$output" = "none" ]] || [[ "$output" = "system" ]] || [[ "$output" =~ ^[0-9]+\.[0-9]+ ]]
8485
}
8586

8687
@test "find_phpvmrc returns error when no file exists" {

0 commit comments

Comments
 (0)