PMA\libraries\config\FormDisplay::displayErrors PHP Method

displayErrors() public method

Displays errors
public displayErrors ( ) : string
return string HTML for errors
    public function displayErrors()
    {
        $this->_validate();
        if (count($this->_errors) == 0) {
            return null;
        }
        $htmlOutput = '';
        foreach ($this->_errors as $system_path => $error_list) {
            if (isset($this->_systemPaths[$system_path])) {
                $path = $this->_systemPaths[$system_path];
                $name = PMA_langName($path);
            } else {
                $name = $GLOBALS["strConfigForm_{$system_path}"];
            }
            $htmlOutput .= PMA_displayErrors($name, $error_list);
        }
        return $htmlOutput;
    }

Usage Example

コード例 #1
0
 /**
  * Test for FormDisplay::displayErrors
  *
  * @return void
  */
 public function testDisplayErrors()
 {
     $reflection = new \ReflectionClass('PMA\\libraries\\config\\FormDisplay');
     $attrIsValidated = $reflection->getProperty('_isValidated');
     $attrIsValidated->setAccessible(true);
     $attrIsValidated->setValue($this->object, true);
     $attrIsValidated = $reflection->getProperty('_errors');
     $attrIsValidated->setAccessible(true);
     $attrIsValidated->setValue($this->object, array());
     $this->assertNull($this->object->displayErrors());
     $arr = array("Servers/1/test" => array('e1'), "foobar" => array('e2', 'e3'));
     $sysArr = array("Servers/1/test" => "Servers/1/test2");
     $attrSystemPaths = $reflection->getProperty('_systemPaths');
     $attrSystemPaths->setAccessible(true);
     $attrSystemPaths->setValue($this->object, $sysArr);
     $attrIsValidated->setValue($this->object, $arr);
     $GLOBALS['strConfigForm_foobar'] = 'foobar123';
     $result = $this->object->displayErrors();
     $this->assertEquals('<dl><dt>Servers_test2_name</dt>' . '<dd>e1</dd></dl><dl><dt>foobar123</dt><dd>' . 'e2</dd><dd>e3</dd></dl>', $result);
 }
All Usage Examples Of PMA\libraries\config\FormDisplay::displayErrors