Esempio n. 1
0
    function testErrorInParentCanBeCaught()
    {
        $this->sandbox->assignCallback('callbackWithError', function () {
            trigger_error('error in this callback', E_USER_ERROR);
        });
        $res = $this->sandbox->execute(<<<CODE
            try {
                \$parent->callbackWithError('test');
            } catch(\\Exception \$e) {
                return \$e->getMessage();
            }
CODE
);
        $this->assertEquals('error in this callback', $res);
    }
Esempio n. 2
0
 public function testChildCwdIsTheJail()
 {
     $res = $this->sandbox->execute('return file_get_contents("jailed.txt");');
     $this->assertStringEqualsFile($this->jail . '/jailed.txt', $res);
 }