(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func 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, ®ularThread{}, 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 | |
| 66 | func TestTransitionAThreadBetween2DifferentWorkers(t *testing.T) { |
| 67 | setupGlobals(t) |
nothing calls this directly
no test coverage detected