You can pass a string of magic constant name, or pass an array of the magic constant names to whitelist
public whitelistMagicConst ( string | array $name ) | ||
$name | string | array | String of magic constant name or array of magic constant names to whitelist |
/** * Test whether sandbox disallows violating callbacks */ public function testWhitelistMagicConstants() { $this->sandbox->whitelistMagicConst('DIR'); $this->assertEquals(str_replace('tests', 'src', __DIR__), $this->sandbox->execute(function () { return __DIR__; })); }