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

Method verifyPHPSymbols

internal/extgen/integration_test.go:223–254  ·  view source on GitHub ↗

verifyPHPSymbols checks if PHP can find the exposed functions, classes, and constants

(functions []string, classes []string, constants []string)

Source from the content-addressed store, hash-verified

221
222// verifyPHPSymbols checks if PHP can find the exposed functions, classes, and constants
223func (s *IntegrationTestSuite) verifyPHPSymbols(functions []string, classes []string, constants []string) error {
224 s.t.Helper()
225
226 var checks []string
227
228 for _, fn := range functions {
229 checks = append(checks, fmt.Sprintf("if (!function_exists('%s')) { echo 'MISSING_FUNCTION: %s'; exit(1); }", fn, fn))
230 }
231
232 for _, cls := range classes {
233 checks = append(checks, fmt.Sprintf("if (!class_exists('%s')) { echo 'MISSING_CLASS: %s'; exit(1); }", cls, cls))
234 }
235
236 for _, cnst := range constants {
237 checks = append(checks, fmt.Sprintf("if (!defined('%s')) { echo 'MISSING_CONSTANT: %s'; exit(1); }", cnst, cnst))
238 }
239
240 checks = append(checks, "echo 'OK';")
241
242 phpCode := "<?php\n" + strings.Join(checks, "\n")
243
244 output, err := s.runPHPCode(phpCode)
245 if err != nil {
246 return err
247 }
248
249 if !strings.Contains(output, "OK") {
250 return fmt.Errorf("symbol verification failed: %s", output)
251 }
252
253 return nil
254}
255
256func (s *IntegrationTestSuite) verifyFunctionBehavior(phpCode string, expectedOutput string) error {
257 s.t.Helper()

Callers 5

TestBasicFunctionFunction · 0.80
TestConstantsFunction · 0.80
TestNamespaceFunction · 0.80
TestCallableFunction · 0.80

Calls 1

runPHPCodeMethod · 0.95

Tested by

no test coverage detected