Skip to content

Commit df197b2

Browse files
committed
extend test
1 parent 98268f6 commit df197b2

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

caddy/caddy_test.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,25 +462,41 @@ func TestPHPServerDirective(t *testing.T) {
462462
tester.AssertGetResponse("http://localhost:"+testPort+"/not-found.txt", http.StatusOK, "I am by birth a Genevese (i not set)")
463463
}
464464

465-
func TestPHPServerDirectiveWorker(t *testing.T) {
465+
func TestPHPServerDirectiveWorkers(t *testing.T) {
466+
t.Setenv("ONE", "one")
467+
t.Setenv("TWO", "two")
466468
tester := caddytest.NewTester(t)
467469
initServer(t, tester, `
468470
{
469471
skip_install_trust
470472
admin localhost:2999
471473
http_port `+testPort+`
472474
https_port 9443
475+
frankenphp {
476+
php_ini variables_order "EGPCS" # populate $_ENV
477+
}
473478
}
474479
475480
localhost:`+testPort+` {
481+
@env path /env.php*
482+
php_server @env {
483+
root ../testdata/env # self defined root
484+
worker env.php
485+
}
476486
root ../testdata
487+
handle /index.php {
488+
root ../testdata/dirindex
489+
php_server # inherits from root ../testdata/dirindex
490+
}
477491
php_server {
478-
worker worker-with-counter.php
492+
worker worker-with-counter.php # inherits from root ../testdata
479493
}
480494
}
481495
`, "caddyfile")
482496

483497
tester.AssertGetResponse("http://localhost:"+testPort+"/worker-with-counter.php", http.StatusOK, "requests:1")
498+
tester.AssertGetResponse("http://localhost:"+testPort+"/index.php", http.StatusOK, "Hello from directory index.php")
499+
tester.AssertGetResponse("http://localhost:"+testPort+"/env.php?keys[]=ONE&keys[]=TWO", http.StatusOK, "ONE=one,TWO=two")
484500
}
485501

486502
func TestPHPServerDirectiveDisableFileServer(t *testing.T) {

0 commit comments

Comments
 (0)