Currently, if a test passes a custom environment into the 'drush' or 'execute' method, we use proc_open with a clean environment to run the test. Unfortunately, this environment is too clean, and may be missing settings needed to make the tests run.
After unsuccessfully trying to find and inject the right environment variables into proc_open, I eventually decided it was, perhaps, more profitable to just save and restore the custom environment settings. Perhaps this is not ideal, but it does work better than the existing code.
Comments
Comment #1
greg.1.anderson commentedFor what it's worth, here is my failed experiment. For some reason, this causes extra whitespace to be added to the end of one of the output lines in outputFormatTest. In comparison, the patch in #0 does not cause this to happen.
Comment #2
moshe weitzman commented#0 fixes the test fail for me. #0 seems RTBC. The only alternative I can think of is to not do any putenv in PHP but set the env only after we shell out. I don't think #0 will leak env changes to subsequent tests, but I'm certain that the code below won't do that.
Also, the new COLUMNS env should have a code comment.
Comment #3
greg.1.anderson commentedOh, yeah, I like #2. I'll roll a new patch.
Comment #4
greg.1.anderson commentedHere's a new patch that works with most of the unit tests, including the output format test and the drush script test; however, it is failing here:
In comparison, this same test does not fail with the patch from #0. Still trying to figure out why that is. It seems that "completetest.drush.inc" is not being included for some reason.
Comment #5
greg.1.anderson commentedHere's a hybrid technique that works.
Comment #6
greg.1.anderson commented#5 worked, so committed it.