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

Function TestPHPAssociativeArrayToPacked

types_test.go:104–122  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestPHPAssociativeArrayToPacked(t *testing.T) {
105 testOnDummyPHPThread(t, func() {
106 originalArray := AssociativeArray[string]{
107 Map: map[string]string{
108 "foo1": "bar1",
109 "foo2": "bar2",
110 },
111 Order: []string{"foo1", "foo2"},
112 }
113 expectedSlice := []string{"bar1", "bar2"}
114
115 phpArray := PHPAssociativeArray(originalArray)
116 defer zendHashDestroy(phpArray)
117 convertedSlice, err := GoPackedArray[string](phpArray)
118 require.NoError(t, err)
119
120 assert.Equal(t, expectedSlice, convertedSlice, "convert an associative array to a slice")
121 })
122}
123
124func TestNestedMixedArray(t *testing.T) {
125 testOnDummyPHPThread(t, func() {

Callers

nothing calls this directly

Calls 3

testOnDummyPHPThreadFunction · 0.85
PHPAssociativeArrayFunction · 0.85
zendHashDestroyFunction · 0.85

Tested by

no test coverage detected