Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32bf1f6

Browse files
committed
Test the renderHelp method in all Tests about help to skip them if necessary.
1 parent 437b77e commit 32bf1f6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Form\Tests;
1313

14+
use PHPUnit\Framework\SkippedTestError;
1415
use Symfony\Component\Form\FormError;
1516
use Symfony\Component\Form\FormView;
1617
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
@@ -115,7 +116,7 @@ abstract protected function renderLabel(FormView $view, $label = null, array $va
115116

116117
protected function renderHelp(FormView $view)
117118
{
118-
$this->markTestSkipped(sprintf('Legacy %s::renderHelp() is not implemented.', get_class($this)));
119+
$this->markTestSkipped(sprintf('%s::renderHelp() is not implemented.', get_class($this)));
119120
}
120121

121122
abstract protected function renderErrors(FormView $view);
@@ -445,6 +446,15 @@ public function testHelpSetLinkFromWidget()
445446
'help' => 'Help text test!',
446447
));
447448
$view = $form->createView();
449+
450+
// Test if renderHelp method is implemented
451+
try {
452+
$this->renderHelp($view);
453+
}
454+
catch (SkippedTestError $error) {
455+
return $error;
456+
}
457+
448458
$html = $this->renderRow($view);
449459

450460
$this->assertMatchesXpath($html,
@@ -458,6 +468,15 @@ public function testHelpNotSetNotLinkedFromWidget()
458468
{
459469
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
460470
$view = $form->createView();
471+
472+
// Test if renderHelp method is implemented
473+
try {
474+
$this->renderHelp($view);
475+
}
476+
catch (SkippedTestError $error) {
477+
return $error;
478+
}
479+
461480
$html = $this->renderRow($view);
462481

463482
$this->assertMatchesXpath($html,

0 commit comments

Comments
 (0)