liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony
http://liip.ch
MIT License
639 stars 182 forks source link

Command Inputs #545

Closed rodnaph closed 5 years ago

rodnaph commented 5 years ago

Is your feature request related to a problem? Please describe. I'm writing a test for a command which accepts user input, so need access to configure the CommandTester inputs.

Describe the solution you'd like I'd like to be able to easily configure the inputs to the command I am testing.

Describe alternatives you've considered I considered splitting the current runCommand into two parts, one for building the command (which would create a CommandTester instance and return it, where it could additionally configured by specific tests) and another for running it. This felt awkward though because the configure/run parameters are better viewed in one place.

Additional context Please let me know if there are better ways to approach this that are already supported, I couldn't find anything in the issues that referenced configuring user input.

alexislefebvre commented 5 years ago

Thanks for the PR.

The liipfunctionaltestbundle:test command doesn't accept input. The testRunCommandWithInputs doesn't check if the command succeeded. It may be interesting to add an optional input in the command and check in the test that it works, for example by outputting the input. So we could be sure that inputs are passed properly.

Could you please do this?

alexislefebvre commented 5 years ago

I added tests in #546.

rodnaph commented 5 years ago

Thanks Alex, sorry I couldn’t get to it first.