humanize example

use Symfony\Component\Form\Exception\BadMethodCallException;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\Fixtures\DummyFormRendererEngine;

class FormRendererTest extends TestCase
{
    public function testHumanize()
    {
        $renderer = new FormRenderer(new DummyFormRendererEngine());

        $this->assertEquals('Is active', $renderer->humanize('is_active'));
        $this->assertEquals('Is active', $renderer->humanize('isActive'));
    }

    public function testRenderARenderedField()
    {
        $this->expectException(BadMethodCallException::class);
        $this->expectExceptionMessage('Field "foo" has already been rendered, save the result of previous render call to a variable and output that instead.');

        $formView = new FormView();
        $formView->vars['name'] = 'foo';
        $formView->setRendered();

        
$scope->getName(),
                            (string) $scope->getPropertyPath(),
                        ],
                        $labelFormat
                    );
                } else {
                    $label = $scope->getConfig()->getOption('label');
                }

                if (false !== $label) {
                    if (null === $label && null !== $this->formRenderer) {
                        $label = $this->formRenderer->humanize($scope->getName());
                    } else {
                        $label ??= $scope->getName();
                    }

                    if (null !== $this->translator) {
                        $form = $scope;
                        $translationParameters[] = $form->getConfig()->getOption('label_translation_parameters', []);

                        do {
                            $translationDomain = $form->getConfig()->getOption('translation_domain');
                            array_unshift(
                                
Home | Imprint | This part of the site doesn't use cookies.