Validator callable must accept two parameters: a string of the normalized name of the checked element,
and the PHPSandbox instance. NOTE: Normalized function names include the namespace and are lowercase!
public setFuncValidator ( callable $callable ) : |
||
$callable | callable | Callable that validates the normalized passed function name |
Résultat | Returns the PHPSandbox instance for fluent querying |
/** * Test whether sandbox custom function validation succeeds */ public function testCustomFunctionValidationFailure() { $this->expectException('PHPSandbox\\Error'); $this->sandbox->setFuncValidator(function ($name) { return $name == 'test'; }); $this->sandbox->execute(function () { test2(); }); }