Skip to content

Commit

Permalink
test: failing test reproducing #767
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed May 16, 2024
1 parent 73e9b64 commit 8b8753c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testdata/worker-getopt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$i = 0;
do {
$ok = frankenphp_handle_request(function () use ($i): void {
echo sprintf("Requests handled: %d\n", $i);

var_export($_GET);
var_export($_POST);
var_export($_SERVER);
});

$i++;

getopt('abc');
} while ($ok);
9 changes: 9 additions & 0 deletions worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ func TestWorkerEnv(t *testing.T) {
}, &testOptions{workerScript: "env.php", nbWorkers: 1, env: map[string]string{"FOO": "bar"}, nbParrallelRequests: 10})
}

func TestWorkerGetOpt(t *testing.T) {
runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
req := httptest.NewRequest("GET", "http://example.com/worker-getopt.php", nil)
w := httptest.NewRecorder()

handler(w, req)
}, &testOptions{workerScript: "worker-getopt.php", nbWorkers: 1, nbParrallelRequests: 1})
}

func ExampleServeHTTP_workers() {
if err := frankenphp.Init(
frankenphp.WithWorkers("worker1.php", 4, map[string]string{"ENV1": "foo"}),
Expand Down

0 comments on commit 8b8753c

Please sign in to comment.