Skip to content

Commit

Permalink
sigh... getting go to set the environment of the script is not workin…
Browse files Browse the repository at this point in the history
…g or I do not understand it
  • Loading branch information
withinboredom committed Oct 15, 2024
1 parent 7b37656 commit fc1fc18
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions frankenphp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,17 +637,10 @@ func testEnv(t *testing.T, opts *testOptions) {

resp := w.Result()
body, _ := io.ReadAll(resp.Body)
// php is not installed or other issue, use the hardcoded output below:
stdoutStderr := "Set MY_VAR successfully.\nMY_VAR = HelloWorld\nUnset MY_VAR successfully.\nMY_VAR is unset.\nMY_VAR set to empty successfully.\nMY_VAR = \nUnset NON_EXISTING_VAR successfully.\nHelloWorld"

// execute the script as regular php script
cmd := exec.Command("php", "-d", "variables_order=EGPCS", "testdata/test-env.php", strconv.Itoa(i))
cmd.Env = append(cmd.Env, "SET_MY_VAR_"+strconv.Itoa(i)+"=HelloWorld")
stdoutStderr, err := cmd.CombinedOutput()
if err != nil {
// php is not installed or other issue, use the hardcoded output below:
stdoutStderr = []byte("Set MY_VAR successfully.\nMY_VAR = HelloWorld\nUnset MY_VAR successfully.\nMY_VAR is unset.\nMY_VAR set to empty successfully.\nMY_VAR = \nUnset NON_EXISTING_VAR successfully.\nHelloWorld")
}

assert.Equal(t, string(stdoutStderr), string(body))
assert.Equal(t, stdoutStderr, string(body))
}, opts)
}

Expand Down

0 comments on commit fc1fc18

Please sign in to comment.