Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] [tests] implement a solution to run make:reset-password command in tests #322

Open
jrushlow opened this issue Jun 6, 2024 · 0 comments
Labels
Minor Minor Enhancement

Comments

@jrushlow
Copy link
Collaborator

jrushlow commented Jun 6, 2024

We introduced a handful of test fixtures in #319 (basically the files make:reset-password generates) so we can run tests against a "real" symfony webapp. This is great, but maintaining fixtures is not ideal. We should:

  • Remove the fixtures (or atlease as many as we can)
  • call make:reset-password right after we call make:user in the functional test
  • run tests against the generated code

The reason why this was not done in #319 - make:reset-password requires user input to successfully execute. To simulate that in a test, we need to:

  1. Create a "test" process
  2. stream the contents of an array of user input e.g. ['question 1 input', 'question 2 input']
  3. execute the test process to run the test

We do this in MakerBundle -> https://github.com/symfony/maker-bundle/blob/main/src/Test/MakerTestEnvironment.php#L333 But that code is internal (and should stay that way for now).

Ideally, we would have a symfonycasts/test-helpers repo (insert better name here) that is "internal" / doesnt provide BC guarantees, etc.. that we can use in reset-password, verify-email, etc... to handle the nuts and bolts of bootstrapping a "app" test.

@jrushlow jrushlow added the Minor Minor Enhancement label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Minor Enhancement
Projects
None yet
Development

No branches or pull requests

1 participant