Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
token system
Priority:
Critical
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
1 Feb 2010 at 23:14 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mcarbone commentedAdding tag.
Comment #2
mcarbone commentedAttached is a patch with tests for every Drupal core token. While writing the tests, I found quite a few various bugs involving token generation code, all of which are also fixed in this patch. Many of these bugs were found in the file token code, which was very outdated.
I'm setting this to 'needs review' since there's a bit to look like, although this patch will fail the testbot until #609118: node.tokens.inc: $node->body issues is resolved, and this patch is tweaked to reflect the fix.
Comment #4
mcarbone commentedHurrah, I was able to get around waiting for #609118: node.tokens.inc: $node->body issues to be resolved by making sure to explicitly create a summary when creating the node, so these tests, if they get by the testbot, are ready to be reviewed for reals.
Comment #5
dave reidAwesome job getting test coverage!
Instead of building the large array of tokens strings to compare, can we run them as individual cases?
This way is going to be much easier to debug when something is going wrong. :)
Comment #6
mcarbone commentedI borrowed that approach from the already existing testTokenReplacement test in system.test, so I assumed it was OK. But I guess since we now have so many more tests like this, it's worth fixing these new ones, and also the existing system ones. Will get to that soon.
Comment #7
dave reidWe should probably split out the comment:changed token into its own issues as well.
Comment #8
mcarbone commentedWhy? There were like 15-20 bugs that I fixed when writing these tests, and the comment:changed one doesn't seem any worse to me than the fact that the file tokens were almost all broken. If you want, we can rename this issue to something like "Fix broken tokens and add tests."
Comment #9
mcarbone commentedRe-wrote the tests to test each token individually as suggested in #5. I left the original tests in system.test alone because they aren't there to test individual tokens, and there is value there in testing them as bigger strings.
Comment #10
mcarbone commentedRe-naming and requesting a re-test.
Comment #11
mcarbone commented#9: 701818_token_tests.patch queued for re-testing.
Comment #13
mcarbone commentedRe-rolled to keep up with HEAD.
Comment #14
webchickBumping to critical.
Comment #15
catchThe node body fix here isn't quite complete, see #609118: node.tokens.inc: $node->body issues which I've just marked as duplicate, but which needs the same fix copying over here. That should be applied to comment body too.
Comment #16
dave reid#13: 701818_token_tests.patch queued for re-testing.
Comment #17
catchNo way this applies since the other patch was just committed.
Comment #18
dave reidComment #19
catch$comment->body needs the same change as was made for $node->body in #609118: node.tokens.inc: $node->body issues, we can't guarantee that safe_value is always set.
Comment #20
dave reidComment #21
catchPatch looks good. All the actual bug fixes are very trivial - renaming variables etc., tests are consistent and there's loads of them, comment->body issue is properly fixed now.
Comment #22
webchickWell this is easily the most satisfying patch I've committed in a long time. Great work, Marco!
Committed to HEAD! :D