[make:*] add ability to generate tests #1497
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This feature is experimental - generated code is likely to change significantly between point releases.
Adds the ability to pass
--with-teststomake:registration,make:reset-password, &make:crudand maker will generate a new PHPUnit test tailored for the specific functionality of that maker. If--with-testsis not passed as an argument, MakerBundle will ask the userDo you want to generate PHPUnit tests? [Experimental].This PR introduces a new internal
CanGenerateTestsTraitthat can be added to any Maker command. The method naming is intended to be intuitive - e.g.configureCommandWithTestsOption()should be called fromconfigureCommand(),interactSetGenerateTests()called ininteract(), &shouldGenerateTests()is used in thegenerate()method in a conditional to determine if the command should generate test code.The userland tests we generate are run against the code generated by their respective makers in our test suite. This should be the case for any tests created going forward.
The tests are created under the
App\Testsnamespace and created in thetests/dir. Possibly in the future we can customize this behavior - but for now - attempting to guess the correct test dir structure && keep everyone happy is outside the scope of this PR 😜make:reset-passwordmake:registrationmake:registrationw/ VerifyEmail- PR [make:security:form-login] add ability to generate tests #1515make:security:form-loginmake:crud- refactor to usecanGenerateTeststrait- Diff PRmake:controllerensure we handle Verifying mail signature failed on prod SymfonyCasts/verify-email-bundle#149 if able- outside the scope of this pr