-
Notifications
You must be signed in to change notification settings - Fork 488
Expand file tree
/
Copy pathphpconfig_test.go
More file actions
36 lines (29 loc) 路 984 Bytes
/
Copy pathphpconfig_test.go
File metadata and controls
36 lines (29 loc) 路 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package frankenphp
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCheckPHPConfig(t *testing.T) {
supported := PHPConfig{Version: PHPVersion{MajorVersion: 8, MinorVersion: 2}, ZTS: true}
t.Run("a supported build is accepted", func(t *testing.T) {
require.NoError(t, checkPHPConfig(supported))
})
t.Run("PHP older than 8.2 is rejected", func(t *testing.T) {
old := supported
old.Version.MinorVersion = 1
assert.ErrorIs(t, checkPHPConfig(old), ErrInvalidPHPVersion)
})
t.Run("Zend signals are rejected in ZTS", func(t *testing.T) {
signals := supported
signals.ZendSignals = true
assert.ErrorIs(t, checkPHPConfig(signals), ErrZendSignals)
})
t.Run("Zend signals are allowed without ZTS", func(t *testing.T) {
// without ZTS the ini entries address the globals directly
signals := supported
signals.ZTS = false
signals.ZendSignals = true
require.NoError(t, checkPHPConfig(signals))
})
}