prepend() public method

Prepend trusted code
public prepend ( string | callable $code )
$code string | callable String or callable of trusted $code to prepend to generated code
Exemplo n.º 1
0
 /**
  * Test whether sandbox autowhitelists trusted code
  */
 public function testAutowhitelistTrustedCode()
 {
     $this->sandbox->prepend(function () {
         function test2()
         {
             return 'Hello World!';
         }
     });
     $this->assertEquals('Hello World!', $this->sandbox->execute(function () {
         return test2();
     }));
     $this->setUp();
     //reset
 }