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

Method runPHPCode

internal/extgen/integration_test.go:201–220  ·  view source on GitHub ↗
(phpCode string)

Source from the content-addressed store, hash-verified

199}
200
201func (s *IntegrationTestSuite) runPHPCode(phpCode string) (string, error) {
202 s.t.Helper()
203
204 if s.frankenphpPath == "" {
205 return "", fmt.Errorf("FrankenPHP not compiled yet")
206 }
207
208 phpFile := filepath.Join(s.tempDir, "test.php")
209 if err := os.WriteFile(phpFile, []byte(phpCode), 0o644); err != nil {
210 return "", fmt.Errorf("failed to create PHP file: %w", err)
211 }
212
213 cmd := exec.Command(s.frankenphpPath, "php-cli", phpFile)
214 output, err := cmd.CombinedOutput()
215 if err != nil {
216 return "", fmt.Errorf("PHP execution failed: %w\nOutput: %s", err, string(output))
217 }
218
219 return string(output), nil
220}
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 {

Callers 2

verifyPHPSymbolsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected