pub fn test_php_scripts_with_condition(
lib_path: impl AsRef<Path>,
scripts: &[ScriptCondition<'_>],
)
Expand description
Check your extension by executing multiple php scripts with custom conditions.
This is the most flexible testing function that allows you to specify different validation conditions for each script. It executes each script with the extension loaded and validates the results using the provided condition functions.
§Arguments
lib_path
- The path to the extension library filescripts
- A slice of tuples containing script paths and their validation conditions
§Panics
Panics if any script execution fails or if any condition function returns false. The panic message will include the path of the failing script.
§Examples
use phper_test::cli::{ScriptCondition, test_php_scripts_with_condition};
use std::process::Output;
let success_condition = |output: Output| output.status.success();
let custom_condition =
|output: Output| String::from_utf8_lossy(&output.stdout).contains("custom check");
let scripts: &[ScriptCondition] = &[
(&"test1.php", &success_condition),
(&"test2.php", &custom_condition),
];
test_php_scripts_with_condition("/path/to/extension.so", scripts);