Skip to content

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

Open
@jrushlow

Description

@jrushlow

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MinorMinor Enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions