Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Nov 2009 at 11:49 UTC
Updated:
10 Feb 2010 at 18:22 UTC
Jump to comment: Most recent file
Comments
Comment #1
damien tournoud commentedHere is the patch.
Comment #2
yched commentedRight. The real solution would be #610072: setUp() function accepting array as arguments, though. The way setUp() currently uses its arguments is really not handy.
Comment #3
dries commentedThis solution isn't quite elegant, IMO but I guess it does the trick.
Comment #4
yched commentedFully agreed - that's why I think the change linked in #2 is the way forward. It's already been committed to simpletest contrib 7 branch (I'm not sure what's the status of this wrt D7 core's simpletest module). API change, though.
Comment #5
webchickHm. I personally lean towards won't fix on this, and tackling #610072: setUp() function accepting array as arguments instead. We should be able to make it accept either a string or an array, for backwards compatibility.
Comment #6
yched commentedre webchick: this is a problem we already faced before, and this exact same code is already in FieldTestCase::setUp(), so while I agree that #610072: setUp() function accepting array as arguments is the way forward, committing this meanwhile doesn't add uglyness that's not already in :-/.
Comment #8
chx commentedtoo late for the other issue. sorry.
Comment #9
webchickOk fair enough. But let's at least leave a one-liner or so explaining why we are doing it this way.
Comment #10
yched commentedThis gets even worse with PHP 5.3 in the mix - see chx's #709346: Field tests are broken in 5.3 and can not be extended
Moved chx's patch over here, and added the comment webchick asked for in #9. And back to RTBC.
That PHP 5.3 subtlety, and the code duplication involved for any test that wants to be subclassable, makes it really unfortunate that this is not being fixed by #610072: setUp() function accepting array as arguments, though...
Comment #11
yched commentedWould #610072: setUp() function accepting array as arguments be acceptable if setUp() could handle both a variable number of strings OR one single array of strings ?
I doubt the code would be so ugly as the one we're adding here...
[edit: actually, that's exactly webchick's proposal in comment #5, which chx crossed as 'too late' (the irony...) - I really think we should reconsider that]
Comment #12
webchickYes, I would really very much rather change the function signature of setUp() in a fully backwards-compatible way than commit complete cruft like this. No offense. ;)
But I don't understand the PHP 5.3.0 hunks and why the other issue is going to fix those. Help?
Comment #13
chx commentedThe other issue helps because then you can call parent::setup($modules) without needing a dynamic call which is not easy.
Comment #14
yched commentedAnd PHP 5.3 needs specific code for dynamic calls to parent::setup($modules) :
http://www.php.net/manual/en/function.call-user-func-array.php#93744
Comment #15
dries commentedI agree with webchick in #12. :)
Comment #16
webchickOk, great. :) Let's reconvene in #610072: setUp() function accepting array as arguments.