configureTypeGuess example



    public function testCreateBuilderForPropertyWithoutTypeGuesser()
    {
        $builder = $this->factory->createBuilderForProperty('Application\Author', 'firstName');

        $this->assertSame('firstName', $builder->getName());
    }

    public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence()
    {
        $this->guesser1->configureTypeGuess(TextType::class['attr' => ['maxlength' => 10]], Guess::MEDIUM_CONFIDENCE);
        $this->guesser2->configureTypeGuess(PasswordType::class['attr' => ['maxlength' => 7]], Guess::HIGH_CONFIDENCE);

        $builder = $this->factory->createBuilderForProperty('Application\Author', 'firstName');

        $this->assertSame('firstName', $builder->getName());
        $this->assertSame(['maxlength' => 7]$builder->getOption('attr'));
        $this->assertInstanceOf(PasswordType::class$builder->getType()->getInnerType());
    }

    public function testCreateBuilderCreatesTextFormIfNoGuess()
    {
        
Home | Imprint | This part of the site doesn't use cookies.