Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
On #2391909: Drush integration I added some Drush commands.
Right now they don't have any tests. They should.
I'd either need to figure out how to do Drush testing, or I guess I could just do a module_load_include(), load the Drush command file, and at least test that the functions return the correct values.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2394603-drush-tests-8.patch | 9.11 KB | jhodgdon |
|
Comments
Comment #1
jhodgdonSome docs on Drush tests:
https://github.com/drush-ops/drush/blob/master/tests/README.md
Comment #2
jhodgdonComment #3
jhodgdonComment #4
TravisCarden CreditAttribution: TravisCarden at Acquia commentedI had to figure this out for Shunt module, @jhodgdon. You can look at what I came up with, in case its of any help to you. @moshe-weitzman confirmed that I did things correctly.
Disclaimer: I did this months and months ago and haven't run it recently, so your mileage may vary. I hope it helps!
Comment #5
jhodgdonThanks! I'll take a look when I have time to get back to this issue.
Comment #6
jhodgdonA bug came up in the diff command... really should make these tests!
Comment #7
jhodgdonI decided the easiest thing was to add tests for the Drush functions to ConfigUpdateTest. I had to make a small change to the drush diff function so that it returned something rather than just printing the output. I tested this Drush command manually and it still works correctly with this change.
This test unfortunately uncovered a Core bug:
#2824410: DiffFormatter component class has leak from core class
So I am attaching a patch here but it will be problematic to commit it until the Core bug is fixed, because the tests will probably fail with 4 exceptions. Sigh. Well, let's see. If the tests pass here I can commit the patch.
Comment #9
jhodgdonYup, that's the core bug. Well, we'll just have to wait until that gets fixed to commit this. Anyway, the Drush tests pass other than this Core exceptions bug.
Comment #10
jhodgdonOh. I need to take out the drush.print if I'm returning the values, or it gets double-printed.
Comment #12
jhodgdonThe core bug was fixed; retesting...
Comment #13
jhodgdonComment #15
jhodgdonYeah, the tests passed this time! Committing these new tests.