Skip to content

Commit

Permalink
Add tests for missing target option
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Feb 20, 2023
1 parent 6061fa3 commit deb094d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Form/SlugTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
use Twig\Environment;

final class SlugTypeTest extends KernelTestCase
Expand Down Expand Up @@ -59,4 +60,14 @@ class="input-group"
str_replace(' >', '>', $rendered),
);
}

public function testMissingTargetThrowsException(): void
{
self::expectException(MissingOptionsException::class);
self::expectExceptionMessage('The required option "target" is missing.');
$this->formFactory->createBuilder()
->add('name', TextType::class)
->add('slug', SlugType::class)
->getForm();
}
}

0 comments on commit deb094d

Please sign in to comment.