(t *testing.T)
| 854 | } |
| 855 | |
| 856 | func 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 | |
| 886 | func TestPhpReturnTypeToGoType(t *testing.T) { |
| 887 | tests := []struct { |
nothing calls this directly
no test coverage detected