@@ -82,6 +82,66 @@ public function getTestDetails(): \Generator
8282 }),
8383 ];
8484
85+ yield 'it_generates_with_uuid ' => [$ this ->createMakerTest ()
86+ ->setSkippedPhpVersions (80100 , 80109 )
87+ ->addExtraDependencies ('symfony/uid ' )
88+ ->run (function (MakerTestRunner $ runner ) {
89+ $ this ->makeUser ($ runner );
90+
91+ $ output = $ runner ->runMaker ([
92+ 'App\Entity\User ' ,
93+ 'app_home ' ,
94+ 95+ 'SymfonyCasts ' ,
96+ ], '--with-uuid ' );
97+
98+ $ this ->assertStringContainsString ('Success ' , $ output );
99+
100+ $ generatedFiles = [
101+ 'src/Controller/ResetPasswordController.php ' ,
102+ 'src/Entity/ResetPasswordRequest.php ' ,
103+ 'src/Form/ChangePasswordFormType.php ' ,
104+ 'src/Form/ResetPasswordRequestFormType.php ' ,
105+ 'src/Repository/ResetPasswordRequestRepository.php ' ,
106+ 'templates/reset_password/check_email.html.twig ' ,
107+ 'templates/reset_password/email.html.twig ' ,
108+ 'templates/reset_password/request.html.twig ' ,
109+ 'templates/reset_password/reset.html.twig ' ,
110+ ];
111+
112+ foreach ($ generatedFiles as $ file ) {
113+ $ this ->assertFileExists ($ runner ->getPath ($ file ));
114+ }
115+
116+ $ resetPasswordRequestEntityContents = file_get_contents ($ runner ->getPath ('src/Entity/ResetPasswordRequest.php ' ));
117+ $ this ->assertStringContainsString ('use Symfony\Component\Uid\Uuid; ' , $ resetPasswordRequestEntityContents );
118+ $ this ->assertStringContainsString ('[ORM\CustomIdGenerator(class: \'doctrine.uuid_generator \')] ' , $ resetPasswordRequestEntityContents );
119+
120+ $ configFileContents = file_get_contents ($ runner ->getPath ('config/packages/reset_password.yaml ' ));
121+
122+ // Flex recipe adds comments in reset_password.yaml, check file was replaced by maker
123+ $ this ->assertStringNotContainsString ('# ' , $ configFileContents );
124+
125+ $ resetPasswordConfig = $ runner ->readYaml ('config/packages/reset_password.yaml ' );
126+
127+ $ this ->assertSame ('App\Repository\ResetPasswordRequestRepository ' , $ resetPasswordConfig ['symfonycasts_reset_password ' ]['request_password_repository ' ]);
128+
129+ $ runner ->writeFile (
130+ 'config/packages/mailer.yaml ' ,
131+ Yaml::dump (['framework ' => [
132+ 'mailer ' => ['dsn ' => 'null://null ' ],
133+ ]])
134+ );
135+
136+ $ runner ->copy (
137+ 'make-reset-password/tests/it_generates_with_normal_setup.php ' ,
138+ 'tests/ResetPasswordFunctionalTest.php '
139+ );
140+
141+ $ runner ->runTests ();
142+ }),
143+ ];
144+
85145 yield 'it_generates_with_translator_installed ' => [$ this ->createMakerTest ()
86146 // @legacy - drop skipped versions when PHP 8.1 is no longer supported.
87147 ->setSkippedPhpVersions (80100 , 80109 )
0 commit comments