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

Function TestPhpTypeToGoType

internal/extgen/validator_test.go:856–884  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

854}
855
856func TestPhpTypeToGoType(t *testing.T) {
857 tests := []struct {
858 phpType string
859 isNullable bool
860 expected string
861 }{
862 {"string", false, "*C.zend_string"},
863 {"string", true, "*C.zend_string"},
864 {"int", false, "int64"},
865 {"int", true, "*int64"},
866 {"float", false, "float64"},
867 {"float", true, "*float64"},
868 {"bool", false, "bool"},
869 {"bool", true, "*bool"},
870 {"array", false, "*C.zend_array"},
871 {"array", true, "*C.zend_array"},
872 {"callable", false, "*C.zval"},
873 {"callable", true, "*C.zval"},
874 {"unknown", false, "any"},
875 }
876
877 validator := Validator{}
878 for _, tt := range tests {
879 t.Run(tt.phpType, func(t *testing.T) {
880 result := validator.phpTypeToGoType(phpType(tt.phpType), tt.isNullable)
881 assert.Equal(t, tt.expected, result, "phpTypeToGoType(%s, %v) should return %s", tt.phpType, tt.isNullable, tt.expected)
882 })
883 }
884}
885
886func TestPhpReturnTypeToGoType(t *testing.T) {
887 tests := []struct {

Callers

nothing calls this directly

Calls 2

phpTypeToGoTypeMethod · 0.95
phpTypeTypeAlias · 0.85

Tested by

no test coverage detected