verifyPHPSymbols checks if PHP can find the exposed functions, classes, and constants
(functions []string, classes []string, constants []string)
| 221 | |
| 222 | // verifyPHPSymbols checks if PHP can find the exposed functions, classes, and constants |
| 223 | func (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 | |
| 256 | func (s *IntegrationTestSuite) verifyFunctionBehavior(phpCode string, expectedOutput string) error { |
| 257 | s.t.Helper() |
no test coverage detected