diff --git a/config/help/MakeForm.txt b/config/help/MakeForm.txt index 86c98c60c..47f39bf2a 100644 --- a/config/help/MakeForm.txt +++ b/config/help/MakeForm.txt @@ -1,16 +1,16 @@ The %command.name% command generates a new form class. -php %command.full_name% UserType +php %command.full_name% UserForm If the argument is missing, the command will ask for the form class interactively. You can optionally specify the bound class in a second argument. This can be the name of an entity like User -php %command.full_name% UserType User +php %command.full_name% UserForm User You can also specify a fully qualified name to another class like \App\Dto\UserData. Slashes must be escaped in the argument. -php %command.full_name% UserType \\App\\Dto\\UserData +php %command.full_name% UserForm \\App\\Dto\\UserData diff --git a/src/Maker/MakeCrud.php b/src/Maker/MakeCrud.php index f535d24bd..8df5ddd25 100644 --- a/src/Maker/MakeCrud.php +++ b/src/Maker/MakeCrud.php @@ -140,9 +140,9 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen $iter = 0; do { $formClassDetails = $generator->createClassNameDetails( - $entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: '').'Type', + $entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: ''), 'Form\\', - 'Type' + 'Form' ); ++$iter; } while (class_exists($formClassDetails->getFullName())); diff --git a/src/Maker/MakeForm.php b/src/Maker/MakeForm.php index 7387ead57..c6738e8f6 100644 --- a/src/Maker/MakeForm.php +++ b/src/Maker/MakeForm.php @@ -51,7 +51,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. %sType)', Str::asClassName(Str::getRandomTerm()))) + ->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. %Form)', Str::asClassName(Str::getRandomTerm()))) ->addArgument('bound-class', InputArgument::OPTIONAL, 'The name of Entity or fully qualified model class name that the new form will be bound to (empty for none)') ->setHelp($this->getHelpFileContents('MakeForm.txt')) ; @@ -80,7 +80,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen $formClassNameDetails = $generator->createClassNameDetails( $input->getArgument('name'), 'Form\\', - 'Type' + 'Form' ); $formFields = ['field_name' => null]; diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index 48a8ae34a..c74cdc4e2 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -548,7 +548,7 @@ public function configureDependencies(DependencyBuilder $dependencies): void private function generateFormClass(ClassNameDetails $userClassDetails, Generator $generator, string $usernameField): ClassNameDetails { $formClassDetails = $generator->createClassNameDetails( - 'RegistrationFormType', + 'RegistrationForm', 'Form\\' ); diff --git a/src/Maker/MakeResetPassword.php b/src/Maker/MakeResetPassword.php index ae7b039c7..371897e39 100644 --- a/src/Maker/MakeResetPassword.php +++ b/src/Maker/MakeResetPassword.php @@ -227,12 +227,12 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen ); $requestFormTypeClassNameDetails = $generator->createClassNameDetails( - 'ResetPasswordRequestFormType', + 'ResetPasswordRequestForm', 'Form\\' ); $changePasswordFormTypeClassNameDetails = $generator->createClassNameDetails( - 'ChangePasswordFormType', + 'ChangePasswordForm', 'Form\\' ); @@ -301,7 +301,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen $generator->generateClass( $requestFormTypeClassNameDetails->getFullName(), - 'resetPassword/ResetPasswordRequestFormType.tpl.php', + 'resetPassword/ResetPasswordRequestForm.tpl.php', [ 'use_statements' => $useStatements, 'email_field' => $this->emailPropertyName, @@ -322,7 +322,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen $generator->generateClass( $changePasswordFormTypeClassNameDetails->getFullName(), - 'resetPassword/ChangePasswordFormType.tpl.php', + 'resetPassword/ChangePasswordForm.tpl.php', ['use_statements' => $useStatements] ); diff --git a/src/Renderer/FormTypeRenderer.php b/src/Renderer/FormTypeRenderer.php index 4b9864322..543278e16 100644 --- a/src/Renderer/FormTypeRenderer.php +++ b/src/Renderer/FormTypeRenderer.php @@ -70,7 +70,7 @@ public function render(ClassNameDetails $formClassDetails, array $formFields, ?C $this->generator->generateClass( $formClassDetails->getFullName(), - 'form/Type.tpl.php', + 'form/Form.tpl.php', [ 'use_statements' => $useStatements, 'bounded_class_name' => $boundClassDetails ? $boundClassDetails->getShortName() : null, diff --git a/templates/form/Type.tpl.php b/templates/form/Form.tpl.php similarity index 100% rename from templates/form/Type.tpl.php rename to templates/form/Form.tpl.php diff --git a/templates/resetPassword/ChangePasswordFormType.tpl.php b/templates/resetPassword/ChangePasswordForm.tpl.php similarity index 100% rename from templates/resetPassword/ChangePasswordFormType.tpl.php rename to templates/resetPassword/ChangePasswordForm.tpl.php diff --git a/templates/resetPassword/ResetPasswordRequestFormType.tpl.php b/templates/resetPassword/ResetPasswordRequestForm.tpl.php similarity index 100% rename from templates/resetPassword/ResetPasswordRequestFormType.tpl.php rename to templates/resetPassword/ResetPasswordRequestForm.tpl.php diff --git a/tests/Maker/MakeCrudTest.php b/tests/Maker/MakeCrudTest.php index 46c63f975..c8f97a6a8 100644 --- a/tests/Maker/MakeCrudTest.php +++ b/tests/Maker/MakeCrudTest.php @@ -39,7 +39,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->runCrudTest($runner, 'it_generates_basic_crud.php'); }), @@ -59,7 +59,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodAdminController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->runCrudTest($runner, 'it_generates_crud_with_custom_controller.php'); }), @@ -80,7 +80,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->assertStringContainsString('tests/Controller/SweetFoodControllerTest.php', $output); $this->runCrudTest($runner, 'it_generates_basic_crud.php'); @@ -107,7 +107,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->assertStringContainsString('tests/Controller/SweetFoodControllerTest.php', $output); $this->runCrudTest($runner, 'it_generates_basic_crud.php'); @@ -145,7 +145,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->runCrudTest($runner, 'it_generates_crud_with_custom_root_namespace.php'); }), @@ -169,7 +169,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->runCrudTest($runner, 'it_generates_basic_crud.php'); self::assertFileEquals( @@ -195,7 +195,7 @@ public function getTestDetails(): \Generator ]); $this->assertStringContainsString('src/Controller/SweetFoodController.php', $output); - $this->assertStringContainsString('src/Form/SweetFoodType.php', $output); + $this->assertStringContainsString('src/Form/SweetFoodForm.php', $output); $this->runCrudTest($runner, 'it_generates_basic_crud.php'); }), diff --git a/tests/Maker/MakeFormTest.php b/tests/Maker/MakeFormTest.php index d707da0b9..be751181f 100644 --- a/tests/Maker/MakeFormTest.php +++ b/tests/Maker/MakeFormTest.php @@ -50,7 +50,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'SourFoodType', + 'SourFoodForm', 'SourFood', ]); @@ -67,7 +67,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'TaskType', + 'TaskForm', '\\App\\Form\\Data\\TaskData', ]); @@ -89,7 +89,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'SourFoodType', + 'SourFoodForm', 'SourFood', ]); @@ -111,7 +111,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'BookType', + 'BookForm', 'Book', ]); @@ -132,7 +132,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'AuthorType', + 'AuthorForm', 'Author', ]); @@ -153,7 +153,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'BookType', + 'BookForm', 'Book', ]); @@ -174,7 +174,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'LibraryType', + 'LibraryForm', 'Library', ]); @@ -195,7 +195,7 @@ public function getTestDetails(): \Generator $runner->runMaker([ // Entity name - 'FoodType', + 'FoodForm', 'Food', ]); diff --git a/tests/Maker/MakeResetPasswordTest.php b/tests/Maker/MakeResetPasswordTest.php index 32c3a615f..ab3355b0e 100644 --- a/tests/Maker/MakeResetPasswordTest.php +++ b/tests/Maker/MakeResetPasswordTest.php @@ -44,8 +44,8 @@ public function getTestDetails(): \Generator $generatedFiles = [ 'src/Controller/ResetPasswordController.php', 'src/Entity/ResetPasswordRequest.php', - 'src/Form/ChangePasswordFormType.php', - 'src/Form/ResetPasswordRequestFormType.php', + 'src/Form/ChangePasswordForm.php', + 'src/Form/ResetPasswordRequestForm.php', 'src/Repository/ResetPasswordRequestRepository.php', 'templates/reset_password/check_email.html.twig', 'templates/reset_password/email.html.twig', @@ -148,8 +148,8 @@ public function getTestDetails(): \Generator $generatedFiles = [ 'src/Controller/ResetPasswordController.php', 'src/Entity/ResetPasswordRequest.php', - 'src/Form/ChangePasswordFormType.php', - 'src/Form/ResetPasswordRequestFormType.php', + 'src/Form/ChangePasswordForm.php', + 'src/Form/ResetPasswordRequestForm.php', 'src/Repository/ResetPasswordRequestRepository.php', 'templates/reset_password/check_email.html.twig', 'templates/reset_password/email.html.twig', @@ -208,8 +208,8 @@ public function getTestDetails(): \Generator $generatedFiles = [ 'src/Controller/ResetPasswordController.php', 'src/Entity/ResetPasswordRequest.php', - 'src/Form/ChangePasswordFormType.php', - 'src/Form/ResetPasswordRequestFormType.php', + 'src/Form/ChangePasswordForm.php', + 'src/Form/ResetPasswordRequestForm.php', 'src/Repository/ResetPasswordRequestRepository.php', 'templates/reset_password/check_email.html.twig', 'templates/reset_password/email.html.twig', @@ -361,7 +361,7 @@ public function getTestDetails(): \Generator $this->assertStringContainsString('ORM\ManyToOne', $contentResetPasswordRequest); // check ResetPasswordRequestFormType - $contentResetPasswordRequestFormType = file_get_contents($runner->getPath('/src/Form/ResetPasswordRequestFormType.php')); + $contentResetPasswordRequestFormType = file_get_contents($runner->getPath('/src/Form/ResetPasswordRequestForm.php')); $this->assertStringContainsString('->add(\'emailAddress\', EmailType::class, [', $contentResetPasswordRequestFormType); // check request.html.twig $contentRequestHtml = file_get_contents($runner->getPath('templates/reset_password/request.html.twig')); diff --git a/tests/fixtures/make-crud/expected/WithCustomRepository.php b/tests/fixtures/make-crud/expected/WithCustomRepository.php index b5fa2da83..9dc2eb8e9 100644 --- a/tests/fixtures/make-crud/expected/WithCustomRepository.php +++ b/tests/fixtures/make-crud/expected/WithCustomRepository.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\SweetFood; -use App\Form\SweetFoodType; +use App\Form\SweetFoodForm; use App\Repository\SweetFoodRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ public function index(SweetFoodRepository $sweetFoodRepository): Response public function new(Request $request, EntityManagerInterface $entityManager): Response { $sweetFood = new SweetFood(); - $form = $this->createForm(SweetFoodType::class, $sweetFood); + $form = $this->createForm(SweetFoodForm::class, $sweetFood); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ public function show(SweetFood $sweetFood): Response #[Route('/{id}/edit', name: 'app_sweet_food_edit', methods: ['GET', 'POST'])] public function edit(Request $request, SweetFood $sweetFood, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(SweetFoodType::class, $sweetFood); + $form = $this->createForm(SweetFoodForm::class, $sweetFood); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/tests/fixtures/make-crud/tests/it_generates_basic_crud.php b/tests/fixtures/make-crud/tests/it_generates_basic_crud.php index 69307fb0d..ffff0025d 100644 --- a/tests/fixtures/make-crud/tests/it_generates_basic_crud.php +++ b/tests/fixtures/make-crud/tests/it_generates_basic_crud.php @@ -22,7 +22,7 @@ public function testIndexAction() $this->assertStringContainsString('New SweetFood', $client->getResponse()->getContent()); $newForm = $crawler->selectButton('Save')->form(); - $client->submit($newForm, ['sweet_food[title]' => 'Candy']); + $client->submit($newForm, ['sweet_food_form[title]' => 'Candy']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); @@ -38,7 +38,7 @@ public function testIndexAction() $this->assertGreaterThan(0, $crawler->filter('input[type=text]')->count()); $editForm = $crawler->selectButton('Update')->form(); - $client->submit($editForm, ['sweet_food[title]' => 'Candy edited']); + $client->submit($editForm, ['sweet_food_form[title]' => 'Candy edited']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); diff --git a/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_controller.php b/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_controller.php index aefdae80a..c3ddbd703 100644 --- a/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_controller.php +++ b/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_controller.php @@ -22,7 +22,7 @@ public function testIndexAction() $this->assertStringContainsString('New SweetFood', $client->getResponse()->getContent()); $newForm = $crawler->selectButton('Save')->form(); - $client->submit($newForm, ['sweet_food[title]' => 'Candy']); + $client->submit($newForm, ['sweet_food_form[title]' => 'Candy']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); @@ -38,7 +38,7 @@ public function testIndexAction() $this->assertGreaterThan(0, $crawler->filter('input[type=text]')->count()); $editForm = $crawler->selectButton('Update')->form(); - $client->submit($editForm, ['sweet_food[title]' => 'Candy edited']); + $client->submit($editForm, ['sweet_food_form[title]' => 'Candy edited']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); diff --git a/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_root_namespace.php b/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_root_namespace.php index 69307fb0d..ffff0025d 100644 --- a/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_root_namespace.php +++ b/tests/fixtures/make-crud/tests/it_generates_crud_with_custom_root_namespace.php @@ -22,7 +22,7 @@ public function testIndexAction() $this->assertStringContainsString('New SweetFood', $client->getResponse()->getContent()); $newForm = $crawler->selectButton('Save')->form(); - $client->submit($newForm, ['sweet_food[title]' => 'Candy']); + $client->submit($newForm, ['sweet_food_form[title]' => 'Candy']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); @@ -38,7 +38,7 @@ public function testIndexAction() $this->assertGreaterThan(0, $crawler->filter('input[type=text]')->count()); $editForm = $crawler->selectButton('Update')->form(); - $client->submit($editForm, ['sweet_food[title]' => 'Candy edited']); + $client->submit($editForm, ['sweet_food_form[title]' => 'Candy edited']); $this->assertTrue($client->getResponse()->isRedirect()); $crawler = $client->followRedirect(); diff --git a/tests/fixtures/make-form/tests/it_generates_basic_form.php b/tests/fixtures/make-form/tests/it_generates_basic_form.php index 42f30b73f..232744620 100644 --- a/tests/fixtures/make-form/tests/it_generates_basic_form.php +++ b/tests/fixtures/make-form/tests/it_generates_basic_form.php @@ -2,7 +2,7 @@ namespace App\Tests; -use App\Form\FooBarType; +use App\Form\FooBarForm; use Symfony\Component\Form\Test\TypeTestCase; class GeneratedFormTest extends TypeTestCase @@ -13,7 +13,7 @@ public function testGeneratedForm() 'field_name' => 'field_value', ]; - $form = $this->factory->create(FooBarType::class); + $form = $this->factory->create(FooBarForm::class); $form->submit($formData); $this->assertTrue($form->isSynchronized()); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_embeddable_entity.php b/tests/fixtures/make-form/tests/it_generates_form_with_embeddable_entity.php index bab65fb96..372fee664 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_embeddable_entity.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_embeddable_entity.php @@ -3,7 +3,7 @@ namespace App\Tests; use App\Entity\Food; -use App\Form\FoodType; +use App\Form\FoodForm; use Symfony\Component\Form\Test\TypeTestCase; class GeneratedFormTest extends TypeTestCase @@ -14,7 +14,7 @@ public function testGeneratedForm() 'title' => 'lemon', ]; - $form = $this->factory->create(FoodType::class); + $form = $this->factory->create(FoodForm::class); $form->submit($formData); $object = new Food(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_entity.php b/tests/fixtures/make-form/tests/it_generates_form_with_entity.php index fdce756b5..5364d34d1 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_entity.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_entity.php @@ -3,7 +3,7 @@ namespace App\Tests; use App\Entity\SourFood; -use App\Form\SourFoodType; +use App\Form\SourFoodForm; use Symfony\Component\Form\Test\TypeTestCase; class GeneratedFormTest extends TypeTestCase @@ -14,7 +14,7 @@ public function testGeneratedForm() 'title' => 'lemon', ]; - $form = $this->factory->create(SourFoodType::class); + $form = $this->factory->create(SourFoodForm::class); $form->submit($formData); $object = new SourFood(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_many_to_many_relation.php b/tests/fixtures/make-form/tests/it_generates_form_with_many_to_many_relation.php index 5be663aa6..14ccde16f 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_many_to_many_relation.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_many_to_many_relation.php @@ -4,7 +4,7 @@ use App\Entity\Library; use App\Entity\Book; -use App\Form\BookType; +use App\Form\BookForm; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityRepository; @@ -23,7 +23,7 @@ class GeneratedFormTest extends TypeTestCase */ public function testGeneratedFormWithMultipleChoices($formData, $collection) { - $form = $this->factory->create(BookType::class); + $form = $this->factory->create(BookForm::class); $form->submit($formData); $object = new Book(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_many_to_one_relation.php b/tests/fixtures/make-form/tests/it_generates_form_with_many_to_one_relation.php index f73845cd5..509c061d4 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_many_to_one_relation.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_many_to_one_relation.php @@ -4,7 +4,7 @@ use App\Entity\Author; use App\Entity\Book; -use App\Form\BookType; +use App\Form\BookForm; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Mapping\ClassMetadata; @@ -26,7 +26,7 @@ public function testGeneratedForm() 'author' => 0, ]; - $form = $this->factory->create(BookType::class); + $form = $this->factory->create(BookForm::class); $form->submit($formData); $object = new Book(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_non_entity_dto.php b/tests/fixtures/make-form/tests/it_generates_form_with_non_entity_dto.php index 31ace6937..b37123f04 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_non_entity_dto.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_non_entity_dto.php @@ -12,7 +12,7 @@ namespace App\Tests; use App\Form\Data\TaskData; -use App\Form\TaskType; +use App\Form\TaskForm; use Symfony\Component\Form\Test\TypeTestCase; class GeneratedFormTest extends TypeTestCase @@ -28,7 +28,7 @@ public function testGeneratedForm() $objectToCompare = new TaskData(); - $form = $this->factory->create(TaskType::class, $objectToCompare); + $form = $this->factory->create(TaskForm::class, $objectToCompare); $form->submit($formData); $object = new TaskData(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_one_to_many_relation.php b/tests/fixtures/make-form/tests/it_generates_form_with_one_to_many_relation.php index 296f2e8d7..35ad106b7 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_one_to_many_relation.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_one_to_many_relation.php @@ -4,7 +4,7 @@ use App\Entity\Author; use App\Entity\Book; -use App\Form\AuthorType; +use App\Form\AuthorForm; use Symfony\Component\Form\PreloadedExtension; use Symfony\Component\Form\Test\TypeTestCase; @@ -16,7 +16,7 @@ public function testGeneratedForm() 'name' => 'foo', ]; - $form = $this->factory->create(AuthorType::class); + $form = $this->factory->create(AuthorForm::class); $form->submit($formData); $object = new Author(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_one_to_one_relation.php b/tests/fixtures/make-form/tests/it_generates_form_with_one_to_one_relation.php index deb501726..172536095 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_one_to_one_relation.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_one_to_one_relation.php @@ -4,7 +4,7 @@ use App\Entity\Librarian; use App\Entity\Library; -use App\Form\LibraryType; +use App\Form\LibraryForm; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Mapping\ClassMetadata; @@ -26,7 +26,7 @@ public function testGeneratedForm() 'librarian' => 0, ]; - $form = $this->factory->create(LibraryType::class); + $form = $this->factory->create(LibraryForm::class); $form->submit($formData); $object = new Library(); diff --git a/tests/fixtures/make-form/tests/it_generates_form_with_single_table_inheritance_entity.php b/tests/fixtures/make-form/tests/it_generates_form_with_single_table_inheritance_entity.php index fdce756b5..5364d34d1 100644 --- a/tests/fixtures/make-form/tests/it_generates_form_with_single_table_inheritance_entity.php +++ b/tests/fixtures/make-form/tests/it_generates_form_with_single_table_inheritance_entity.php @@ -3,7 +3,7 @@ namespace App\Tests; use App\Entity\SourFood; -use App\Form\SourFoodType; +use App\Form\SourFoodForm; use Symfony\Component\Form\Test\TypeTestCase; class GeneratedFormTest extends TypeTestCase @@ -14,7 +14,7 @@ public function testGeneratedForm() 'title' => 'lemon', ]; - $form = $this->factory->create(SourFoodType::class); + $form = $this->factory->create(SourFoodForm::class); $form->submit($formData); $object = new SourFood(); diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php index 97e5428e7..c3cc45dbf 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\User; -use App\Form\RegistrationFormType; +use App\Form\RegistrationForm; use App\Security\StubAuthenticator; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -19,7 +19,7 @@ class RegistrationController extends AbstractController public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response { $user = new User(); - $form = $this->createForm(RegistrationFormType::class, $user); + $form = $this->createForm(RegistrationForm::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php index 1fd6787d8..7e4406fef 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\User; -use App\Form\RegistrationFormType; +use App\Form\RegistrationForm; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\SecurityBundle\Security; @@ -18,7 +18,7 @@ class RegistrationController extends AbstractController public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response { $user = new User(); - $form = $this->createForm(RegistrationFormType::class, $user); + $form = $this->createForm(RegistrationForm::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php index 8863f9342..a5833fd89 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\User; -use App\Form\RegistrationFormType; +use App\Form\RegistrationForm; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -17,7 +17,7 @@ class RegistrationController extends AbstractController public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response { $user = new User(); - $form = $this->createForm(RegistrationFormType::class, $user); + $form = $this->createForm(RegistrationForm::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php index 1e23dd893..39e5c7d15 100644 --- a/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php +++ b/tests/fixtures/make-registration-form/tests/it_generates_registration_with_entity_and_authenticator.php @@ -26,6 +26,7 @@ public function testRegistrationSuccessful() $form['registration_form[agreeTerms]'] = true; $client->submit($form); + dump($client->getResponse()); $this->assertSame(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $this->assertSame(200, $client->getResponse()->getStatusCode());