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.
There are a lot of tests in the filter.module and elsewhere throughout Drupal core that have code like this:
$filtered_html_format = db_query_range('SELECT * FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'Filtered HTML'))->fetchObject();
That ugly code is no longer necessary anymore due to #934050: Change format into string - instead, we can just use the known, machine-readable name of the format directly, i.e. we could call filter_format_load('filtered_html')
in the example above.
Comment | File | Size | Author |
---|---|---|---|
#7 | drupal.filter-format-tests.7.patch | 16.43 KB | sun |
#6 | drupal.filter-format-tests.6.patch | 15.11 KB | sun |
#4 | drupal.filter-format-tests.4.patch | 14.11 KB | sun |
#2 | drupal.filter-format-tests.2.patch | 14.1 KB | sun |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedI'm tagging this "Novice", although maybe it's not for extreme novices. But it's a good patch for someone who wants to learn their way around a bunch of core tests.
Comment #2
sunWhile somewhat novice, I'd like to ensure some sanity here.
Comment #4
sunStupid copy and paste mistake, sorry. Looks RTBC to me.
Comment #6
sunFixed those test failures:
In FilterAdminTestCase, a new text format is created (or edited) in the internal browser. Afterwards, the test code in the parent site tries to load that format in order to build administration URLs. However, filter_format_load() resp. filter_formats() is statically cached, so the new format does not exist in the parent site.
Comment #7
sunRemoved needless usage of filter_format_load() where possible.
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedLooks perfectly reasonable to me.
I also checked for places this patch might have missed, and couldn't find any. This seems to catch/fix all cases where the text formats were loaded by human-readable name.
Comment #9
webchickThis looks like a good clean-up to me, as long as contrib tests aren't affected by the loss of those two functions. If we receive any reports of breakage, we're going to need to add those back in as dumb wrappers with a "@todo remove in D8" around them.
Committed to HEAD.