tests(extgen): add integration tests (#1984)

Fix #1975
This commit is contained in:
Alexandre Daubois
2025-12-12 14:32:00 +01:00
committed by GitHub
parent 225ca409d3
commit 599c92b15d
9 changed files with 980 additions and 2 deletions

32
testdata/integration/basic_function.go vendored Normal file
View File

@@ -0,0 +1,32 @@
package testintegration
// #include <Zend/zend_types.h>
import "C"
import (
"strings"
"unsafe"
"github.com/dunglas/frankenphp"
)
// export_php:function test_uppercase(string $str): string
func test_uppercase(s *C.zend_string) unsafe.Pointer {
str := frankenphp.GoString(unsafe.Pointer(s))
upper := strings.ToUpper(str)
return frankenphp.PHPString(upper, false)
}
// export_php:function test_add_numbers(int $a, int $b): int
func test_add_numbers(a int64, b int64) int64 {
return a + b
}
// export_php:function test_multiply(float $a, float $b): float
func test_multiply(a float64, b float64) float64 {
return a * b
}
// export_php:function test_is_enabled(bool $flag): bool
func test_is_enabled(flag bool) bool {
return !flag
}