MCPcopy Create free account
hub / github.com/php/frankenphp / TestGoTypeToPHPType

Function TestGoTypeToPHPType

internal/extgen/classparser_test.go:268–296  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

266}
267
268func TestGoTypeToPHPType(t *testing.T) {
269 tests := []struct {
270 goType string
271 expected phpType
272 }{
273 {"string", phpString},
274 {"*string", phpString},
275 {"int", phpInt},
276 {"int64", phpInt},
277 {"*int", phpInt},
278 {"float64", phpFloat},
279 {"*float32", phpFloat},
280 {"bool", phpBool},
281 {"*bool", phpBool},
282 {"[]string", phpArray},
283 {"map[string]int", phpArray},
284 {"*[]int", phpArray},
285 {"any", phpMixed},
286 {"CustomType", phpMixed},
287 }
288
289 parser := classParser{}
290 for _, tt := range tests {
291 t.Run(tt.goType, func(t *testing.T) {
292 result := parser.goTypeToPHPType(tt.goType)
293 assert.Equal(t, tt.expected, result, "goTypeToPHPType(%s) = %s, want %s", tt.goType, result, tt.expected)
294 })
295 }
296}
297
298func TestTypeToString(t *testing.T) {
299 tests := []struct {

Callers

nothing calls this directly

Calls 1

goTypeToPHPTypeMethod · 0.95

Tested by

no test coverage detected