FrameworkBundle Tests

This commit is contained in:
Mathieu Piot 2018-02-28 08:54:30 +01:00 committed by Mathieu Piot
parent 4f2581d7da
commit ba798dfdf4
6 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,3 @@
<?php if (!empty($help)): ?>
<p class="help-text"><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?></p>
<?php endif ?>

View File

@ -2,4 +2,5 @@
<?php echo $view['form']->label($form) ?>
<?php echo $view['form']->errors($form) ?>
<?php echo $view['form']->widget($form) ?>
<?php echo $view['form']->help($form); ?>
</div>

View File

@ -5,5 +5,6 @@
<td>
<?php echo $view['form']->errors($form); ?>
<?php echo $view['form']->widget($form); ?>
<?php echo $view['form']->help($form); ?>
</td>
</tr>

View File

@ -169,6 +169,19 @@ class FormHelper extends Helper
return $this->renderer->searchAndRenderBlock($view, 'label', $variables);
}
/**
* Renders the help of the given view.
*
* @param FormView $view The parent view
* @param array $variables An array of variables
*
* @return string The HTML markup
*/
public function help(FormView $view, array $variables = array())
{
return $this->renderer->searchAndRenderBlock($view, 'help', $variables);
}
/**
* Renders the errors of the given view.
*

View File

@ -91,6 +91,11 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
return (string) $this->engine->get('form')->label($view, $label, $vars);
}
protected function renderHelp(FormView $view, array $vars = array())
{
return (string) $this->engine->get('form')->help($view);
}
protected function renderErrors(FormView $view)
{
return (string) $this->engine->get('form')->errors($view);

View File

@ -92,6 +92,11 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
return (string) $this->engine->get('form')->label($view, $label, $vars);
}
protected function renderHelp(FormView $view, array $vars = array())
{
return (string) $this->engine->get('form')->help($view);
}
protected function renderErrors(FormView $view)
{
return (string) $this->engine->get('form')->errors($view);