Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
simpletest.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Sep 2015 at 11:22 UTC
Updated:
6 Oct 2015 at 07:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
aneek commented@pwolanin, interesting thought. But both the methods return messages on both pass or fail. As an example if I test with
TestBase::assertEqual('foo', 'bar')and should it not give me Value 'foo' is equal to value 'bar'? From that message we can surely identify that the test failed. But yes, we can have something like$this->verbose()if the assertion fails.What are your thoughts on this?
Thanks.
Comment #3
pwolanin commentedLike this.
Comment #4
stefan.r commentedSo this overwrites the existing message which on failure seems fine. Should we concatenate both?
I don't see any reason not to do this, let's do it for assertEqual as well?
Comment #5
aneek commentedGot you @pwolanin, I'll also have a go..
Comment #6
aneek commentedUploading a new patch. Please review!
Comment #7
stefan.r commentedMaybe let's concatenate it with the original message, just in case people do a search for it in the results still expecting the old behavior.
Comment #8
pwolanin commentedNot sure what the right separator is - here I used "\n" and also extended the fix to assertNotEqual() and assertNotIdentical()
Comment #10
stefan.r commentedCan we have screenshots of what this looks like in CLI and web interface just to make sure the separator looks good?
Comment #11
pwolanin commentedlooks ok - not sure if we have any better options. Here's how it looks hacking in a test fail.
Comment #12
pwolanin commentedre-uploading patch since testbot was borked
Comment #13
stefan.r commentedPatch looks great, this seems super useful!
Seems we missed that one in #2560729: Cast objects implementing SafeStringInterface to string in TestBase / WebTestBase. I think we can include this in this patch because the added var_export may otherwise fatal on a test fail.
Comment #14
aneek commented@pwolanin & @stefan.r, shouldn't we use
PHP_EOLnewline character in a cross-platform-compatible way, so it handles DOS/Mac/Unix issues?Uploading a patch with
PHP_EOLand marking for review.Also a thought, the CLI output gives a new line break with the message & the default message. But the WebUI doesn't. Should it be good if for WebUI this new line break is converted to HTML break line?
What do you guys think about this?
Comment #15
aneek commentedComment #16
pwolanin commentedI don't have a strong feeling either way. A few other places in core just use a \n like:
$failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description'];I agree it would be nice to have a break in the UI, but we'd need to use a BR tag or make more substantial changes to the way tests are output, which seems out of scope here.
Comment #17
aneek commented@pwolanin, I do agree with your thoughts. Using
"\n"doesn't create any problems with Drupal in Unix or Mac OS, but might create issues in Windows because,Source:https://en.wikipedia.org/wiki/Newline
And also current core uses a lot of
"\n"and lesserPHP_EOL. Yes, this is totally out of scope to convert newline to line break. A basic algorithm could be,PHP_EOL(PHP_SAPI = true) or<br />(PHP_SAPI = false)However, the questions are,
PHP_EOLin this fix? - Great if others provide their feedback as well."\n"where necessary withPHP_EOLor<br />?Thanks!
Comment #18
pwolanin commented@aneek - we don't currently change the messages based on cli or not, and there doesn't seem to be much support for that added complexity. I think you are over-thinking this small change that only affects tests. Possibly it's more correct to use PHP_EOL, so let's just go with that.
Comment #20
alexpottCommitted f5647da and pushed to 8.0.x. Thanks!