Example #1
0
 private function render($page)
 {
     $template_path = $GLOBALS['template_dir'] . $page;
     $template = file_get_contents($template_path);
     $this->context['ERRORS'] = UserError::format();
     foreach ($this->context as $var => $value) {
         $template = str_replace("{{ {$var} }}", $value, $template);
     }
     $output = preg_replace('/\\{\\{.+?\\}\\}/', '', $template);
     echo $output;
 }
 /**
  * @covers UserError::__toString
  */
 public function test__toString()
 {
     $msg = "This field is requires";
     $this->object->setMessage($msg);
     $this->assertEquals($msg, $this->object->__toString());
 }
Example #3
0
 public function addErrorMessage($msg)
 {
     $error = new UserError();
     $error->setMessage($msg);
     $this->errors[] = $error;
 }