Ejemplo n.º 1
0
 /**
  * @dataProvider dataProvider
  */
 public function testExpression($assign, $src, $dst, $result)
 {
     try {
         $info = $this->cpl->compileExpression($src, $assign, Opt_Compiler_Class::ESCAPE_BOTH);
         if ($result == 0) {
             $this->assertEquals($dst, $info[0]);
             return true;
         }
         $this->fail('Exception NOT returned, but should be: ' . $result);
     } catch (Opt_Exception $e) {
         if ($result !== 0) {
             if ($result != get_class($e)) {
                 $this->fail('Invalid exception returned: #' . get_class($e) . ', ' . $result . ' expected.');
             }
             return true;
         }
         $this->fail('Exception returned: #' . get_class($e) . ': ' . $e->getMessage() . ' (line: ' . $e->getLine() . ')');
     }
 }