/**
  * Formats form information as HTML.
  * 
  * @param  string $name
  * @param  sfForm $form
  * 
  * @return string
  */
 protected function formatFormAsHtml($name, sfForm $form)
 {
     static $i = 0;
     $i++;
     if ($form->hasErrors() && sfLogger::NOTICE < $this->getStatus()) {
         $this->setStatus(sfLogger::NOTICE);
     }
     $html = array();
     $html[] = $this->getParameterDescription($name, $form, $form->hasErrors() ? '<code class="sfWebDebugWarning">$%s</code>' : null);
     $html[] = $this->getToggler('sfWebDebugViewForm' . $i);
     $html[] = '<div id="sfWebDebugViewForm' . $i . '" style="display:none">';
     foreach ($form->getGlobalErrors() as $error) {
         $html[] = sprintf('<p><span class="sfWebDebugWarning">%s</span></p>', $error);
     }
     $html[] = '<ul>' . $this->formatFormFieldSchemaAsHtml($form->getFormFieldSchema(), $name . '[%s]') . '</ul>';
     $html[] = '</div>';
     return join("\n", $html);
 }
 /**
  * Assert form has erros
  *
  * @param sfForm $form
  * @param int    $errorsCount
  * @param string $message
  */
 protected function assertFormHasErrors(sfForm $form, $errorsCount, $message = null)
 {
     $message = $message ? $message . PHP_EOL : null;
     if (!$form->hasErrors()) {
         $this->fail($this->makeErrorMess($form, $message . 'Expected form HAS errors'));
     }
     $this->assertEquals((int) $errorsCount, $form->getErrorSchema()->count(), $this->makeErrorMess($form, $message . 'Errors count'));
 }