MCPcopy Index your code
hub / github.com/php/frankenphp / TestTransitionRegularThreadToWorkerThread

Function TestTransitionRegularThreadToWorkerThread

phpmainthread_test.go:41–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestTransitionRegularThreadToWorkerThread(t *testing.T) {
42 setupGlobals(t)
43
44 _, err := initPHPThreads(1, 1, nil)
45 assert.NoError(t, err)
46
47 // transition to regular thread
48 convertToRegularThread(phpThreads[0])
49 assert.IsType(t, &regularThread{}, phpThreads[0].handler)
50
51 // transition to worker thread
52 worker := getDummyWorker(t, "transition-worker-1.php")
53 convertToWorkerThread(phpThreads[0], worker)
54 assert.IsType(t, &workerThread{}, phpThreads[0].handler)
55 assert.Len(t, worker.threads, 1)
56
57 // transition back to inactive thread
58 convertToInactiveThread(phpThreads[0])
59 assert.IsType(t, &inactiveThread{}, phpThreads[0].handler)
60 assert.Len(t, worker.threads, 0)
61
62 drainPHPThreads()
63 assert.Nil(t, phpThreads)
64}
65
66func TestTransitionAThreadBetween2DifferentWorkers(t *testing.T) {
67 setupGlobals(t)

Callers

nothing calls this directly

Calls 7

setupGlobalsFunction · 0.85
initPHPThreadsFunction · 0.85
convertToRegularThreadFunction · 0.85
getDummyWorkerFunction · 0.85
convertToWorkerThreadFunction · 0.85
convertToInactiveThreadFunction · 0.85
drainPHPThreadsFunction · 0.85

Tested by

no test coverage detected