Reroll patch #2 against 2.x branch.
Closes #3381701
Merge request reports
Activity
added 2 commits
- Resolved by Bhanu D
- Resolved by Conrad Lara
- Resolved by Bhanu D
- Resolved by Bhanu D
- Resolved by Bhanu D
- Resolved by Bhanu D
- Resolved by Bhanu D
- Resolved by Bhanu D
@cmlara do you have any reference for unit testing of drush commands ? or functional test like this is fine ?
added 1 commit
- 1ccb09a2 - Move command logic to a Drush service and add unit testing.
I would prefer unit. That said, your question made me realize I haven't actually converted any other project's functional Drush test Unit and that I really needed to at least look at doing one myself before I put the burden on others.
After a brief discussion in the Drush slack it turns out that there is no good/easy way to mock $this->io(). This necessitates moving the new commands out into a service where we can inject the io.
I've gone ahead and moved the code you have written to a new Drush service. This was mostly a straight copy with a couple of changes to refer to different services values. I was also able to add back in the strict_type as it is a new file. I've also added the tests.
Note: I want to make it clear this reworking isn't intended to be an indicator you did anything wrong or that I did not believe you could make these changes. I did the rework solely because I felt an obligation to understand what hurdles others may encounter with testing Drush commands Unit Testing and knowing that I'm responsible for not being aware of this earlier.
Note: I want to make it clear this reworking isn't intended to be an indicator you did anything wrong or that I did not believe you could make these changes.
Hey, I get it No hard feelings. I saw your message in slack channel as well before you posting this here. If you have asked me to write Unit test I might not be able to do so as I am not familiar with this approach. Even if you have asked me to write functional test I would not be able to do so in last week due to my travel and little availability of time.
I did the rework solely because I felt an obligation to understand what hurdles others may encounter with testing Drush commands Unit Testing and knowing that I'm responsible for not being aware of this earlier.
I really appreciate you making your time to actually try to understand how complex it is before asking someone to go down the rabbit hole.
Edited by Bhanu D- Resolved by Conrad Lara
added 2 commits
added 10 commits
-
4b8074ed - 1 commit from branch
project:2.x
- 36b28f14 - Reroll patch #2 against 2.x branch.
- 628d40e0 - Updated Code.
- 604d3917 - Updated logger messages.
- 796c8e94 - Updated return message.
- 9b7e78d9 - Apply 4 suggestion(s) to 1 file(s)
- ba8cf0d4 - Update TfaCommands.php
- 84725578 - Move command logic to a Drush service and add unit testing.
- 0b30fe6e - Rename TokenManagement to TfaTokenManagement.
- cbfc7ee4 - Update baseline.
Toggle commit list-
4b8074ed - 1 commit from branch
enabled automatic add to merge train when the pipeline for d670f136 succeeds