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.
A term like "0 years" is always tagged as soon as the word "years" is found, since array_filter() in the rules_autotag_split_text will remove the word "0", so the module will actually try to tagg "years".
Comment | File | Size | Author |
---|---|---|---|
#7 | rules_autotag-zero_term_issue-3080089-7-7.x-dev.patch | 2.06 KB | sepgil |
Comments
Comment #2
sepgil CreditAttribution: sepgil at jobiqo - job board technology commentedHere is a patch that will fix the issue and add a unit test class for the rules_autotag_split_text() function.
Comment #3
sepgil CreditAttribution: sepgil at jobiqo - job board technology commentedComment #4
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedThx for the patch Sebastian!
I have two remarks:
* We should use drupal_strlen() instead of strlen()
* Why not re-use RulesAutotagTestCase for the test case? This way we would have all test cases in one place
Comment #5
sepgil CreditAttribution: sepgil at jobiqo - job board technology commentedRight, added a new patch for drupal_strlen().
Regarding the tests:
This are pure unit tests and using DrupalUnitTestCase allows them to run much faster than with DrupalWebTestCase, which takes a lot of time and resources.
Secondly the RulesAutotagTestCase class was failing for me, at line 15 when the rules_autotag module should be enabled. Not sure yet if that was a jobiqo specific problem or a general issue.
The tests are grouped by the modules name, so I don't see the big advantage here.
Comment #6
klausiThanks, the tests make sense!
I think this can be simplified a lot:
Instead of using array_filter we should remove it completely and pass the flag PREG_SPLIT_NO_EMPTY to preg_split(). That way we never get empty strings back and this is much simpler.
which is valid.
There should be an empty line after the last method in a class.
Comment #7
sepgil CreditAttribution: sepgil at jobiqo - job board technology commentedRight, make sense. Here's a patch that replaces the array_filter with the flag.
Comment #8
klausiSuper, thanks!
Added you as maintainer, please commit and create a new release.
Comment #10
sepgil CreditAttribution: sepgil at jobiqo - job board technology commented