Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This function is not used in core so I think no test could be done
Comment | File | Size | Author |
---|---|---|---|
#23 | 1421410-title-attribute-23-test-only.patch | 2.26 KB | Niklas Fiekas |
#23 | 1421410-title-attribute-23.patch | 3.73 KB | Niklas Fiekas |
#23 | 1421410-interdiff-23.txt | 2.18 KB | Niklas Fiekas |
#20 | 1421410-title-attribute-20.patch | 3.76 KB | andypost |
#10 | 1421410-title-attribute.patch | 3.76 KB | andypost |
Comments
Comment #1
andypostpatch for D7
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedi'm not sure if the bug here is the we use $t(), or that we don't have a $t = get_t(); - can someone with FAPI clue comment on this?
also, lets sort it out for D8 before doing the port to D7.
Comment #3
sunThis needs to use
typically done as first line of the function.
Comment #4
sunComment #5
andypostI see no way to test this so simple fix.
Comment #6
andypostadded comment about get_t()
Comment #7
sunNo need for a comment, so #5 is RTBC.
Comment #8
webchickThis seems to have spotted a hole in our test suite. Could we adjust the tests so this function gets hit?
Comment #9
andypostThis functionality was totally broken
So I write a test and improved patch
Comment #10
andypostRemoved commented line in test
Comment #11
sunThe test does not seem to fully trigger the error for some reason. I don't see a fatal error in the testbot results?
Trying to invoke a function name in a undefined string should yield a fatal error:
Comment #12
andypost@sun suppose it depends on bot's php.ini settings
probably core take over a fatal error because it happens in eval() of theme()...wtf!?
because if I enable form_test module with drush and navigate to /form_test/form-labels I got a page without form and not styled. watchdog has only
Notice: Undefined variable: t in form_pre_render_conditional_form_element() (line 3034 of /var/www/core8/core/includes/form.inc).
page get rendered for until title only http://clip2net.com/s/1xJ9n
Comment #13
sunPlease disregard #11, we see the PHP notice in the tests. The fatal error happens in the child site. We'd only see the fatal error if the test itself would attempt to render the form element in the parent site.
Comment #14
andypost@sun so #10 should fix bug or do you have something oposit?
Comment #15
andypostThis issue now depends on wrong commited patch in #1475666: Rollback - PHP error because of typo in form.inc line 3025
Comment #16
webchickThat patch was rolled back, so we should be good to go here.
Comment #17
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedYep. And #1475666: Rollback - PHP error because of typo in form.inc line 3025 was major. (Not sure if it should have been.)
Comment #18
andypost#10: 1421410-title-attribute.patch queued for re-testing.
Comment #19
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedLets get this done ... here's a review:
Shouldn't we use isset() here? Otherwise '0' couldn't be used as a title, could it?
Same here. We also wouldn't need the negation.
The assertion message shouldn't have a t().
Neither this one. (Yes, t() in assertion messages are all around, but cleaning that up is another issue.)
Baby-kitten hunk. (Just saying. If it's here anyway, let's get it in.)
t() in a test again. The rule is not to introduce any *new* translatable strings. So simply remove them.
Here, as well.
Comment #20
andypostTalked in IRC with Niklas Fiekas :
1) isset() is a right choice for string item
2) Removed t() in assert message
3) Baby-kitten hunk. :)
4) keep t() for the form builder items to mimic form_label_test_form() previous elements
Comment #21
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedI don't agree with 4 - very minor point, though, as xjm said. Looks good otherwise. Thank you @andypost!
Comment #22
andypostThe only t() in test form is waiting for review, but I sure we should use t() because this labels are used in assert.
Also this introduces no new strings
This strings already used above in this function and test should check for translated element title
Comment #23
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedIt introduces no new t()'s because some wrong t()'s are already there. That doesn't count :P
Actually it's about decoupling and stuff. Before were discussing "must we really do this" over and over, here is a slightly adjusted patch. No other changes than this minor stuff.
Comment #24
andypostLet's get more reviews
This mix of t() and 'Checkboxes test' looks unreadable
same
Comment #25
xjm@andypost asked me to comment on this issue. It's a little messy but I don't think it's that bad, and honestly I can't think of a better way. This patch looks ready to me.
Edit: Didn't mean to take the backport tag off; not sure why that happened.
Comment #26
andypostI does not want to hold a patch...
talked with xjm - let's proceed with this spaghetti mix of t() and ''
all other parts of this test method uses t() but probably there's a principle
... but for D7 we need a cleaner code, with follow-up for D8
Comment #27
xjmTo clarify, core already has an inconsistent mix of using
t()
and not in test modules, so I don't think it's worth holding the patch back one way or the other. There are arguments both for and against in this case, but at the end of the day it really doesn't make much difference, and I am not comfortable saying it should be one way or another because there isn't consensus. Edit: we have a brief discussion of this point at http://drupal.org/simpletest-tutorial-drupal7#t and the issue to bikeshed about it in is #500866: [META] remove t() from assert message.The patch is also fine to backport as-is.
Comment #28
webchickLooks sane to me. Thanks a bunch for the tests!
Committed and pushed to 8.x and 7.x.