Пример #1
0
 /**
  * Add error message to view.
  * Include field if the message goes on a specific place on the page; otherwise leave it null for the message
  * to be page-level.
  * @param str $msg
  * @param str $field Defaults to null for page-level messages.
  * @param bool $disable_xss Disable HTML encoding tags, defaults to false
  */
 public function addErrorMessage($msg, $field = null, $disable_xss = false)
 {
     $this->disableCaching();
     $this->view_mgr->addErrorMessage($msg, $field, $disable_xss);
 }
Пример #2
0
 public function testAddErrorMessage()
 {
     $cfg = Config::getInstance();
     $cfg->setValue('debug', true);
     $v_mgr = new ViewManager();
     $v_mgr->addErrorMessage('Page level error');
     $v_mgr->addErrorMessage('Field level error', 'fieldname');
     $this->assertEqual($v_mgr->getTemplateDataItem('error_msg'), 'Page level error');
     $debug_arr = $v_mgr->getTemplateDataItem('error_msgs');
     $this->assertEqual($debug_arr['fieldname'], 'Field level error');
     $this->debug(Utils::varDumpToString($debug_arr));
 }