Ejemplo n.º 1
0
 function assertValidXhtml($message = null)
 {
     require_once AK_LIB_DIR . DS . 'AkXhtmlValidator.php';
     $response = $this->_response;
     $validator = new AkXhtmlValidator();
     $valid = $validator->validate($response);
     if (!$valid) {
         $message = empty($message) ? 'Non valid Xhtml: %errors' : $message;
         $message = str_replace('%errors', strip_tags(join("\n- ", $validator->getErrors())), $message);
         $this->fail($message);
     } else {
         $message = empty($message) ? 'XHtml valid' : $message;
         $this->pass($message);
     }
 }
Ejemplo n.º 2
0
 function _validateGeneratedXhtml()
 {
     require_once AK_LIB_DIR . DS . 'AkXhtmlValidator.php';
     $XhtmlValidator = new AkXhtmlValidator();
     if ($XhtmlValidator->validate($this->Response->body) === false) {
         $this->Response->sendHeaders();
         echo '<h1>' . Ak::t('Ooops! There are some errors on current XHTML page') . '</h1>';
         echo '<small>' . Ak::t('In order to disable XHTML validation, set the <b>AK_ENABLE_STRICT_XHTML_VALIDATION</b> constant to false on your config/development.php file') . "</small><hr />\n";
         $XhtmlValidator->showErrors();
         echo "<hr /><h2>" . Ak::t('Showing XHTML code') . "</h2><hr /><div style='border:5px solid red;margin:5px;padding:15px;'>" . $this->Response->body . "</pre>";
         die;
     }
 }