[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-tests
tomake:registration
,make:reset-password
, &make:crud
and maker will generate a new PHPUnit test tailored for the specific functionality of that maker. If--with-tests
is not passed as an argument, MakerBundle will ask the userDo you want to generate PHPUnit tests? [Experimental]
.This PR introduces a new internal
CanGenerateTestsTrait
that 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\Tests
namespace 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-password
make:registration
make:registration
w/ VerifyEmail- PR [make:security:form-login] add ability to generate tests #1515make:security:form-login
make:crud
- refactor to usecanGenerateTests
trait- Diff PRmake:controller
ensure we handle Verifying mail signature failed on prod SymfonyCasts/verify-email-bundle#149 if able- outside the scope of this pr