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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Issue tags: +Novice

I'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.

sun’s picture

Status: Active » Needs review
FileSize
14.1 KB

While somewhat novice, I'd like to ensure some sanity here.

Status: Needs review » Needs work

The last submitted patch, drupal.filter-format-tests.2.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
14.11 KB

Stupid copy and paste mistake, sorry. Looks RTBC to me.

Status: Needs review » Needs work

The last submitted patch, drupal.filter-format-tests.4.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
15.11 KB

Fixed 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.

sun’s picture

Removed needless usage of filter_format_load() where possible.

David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Looks 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.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

This 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.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

Automatically closed -- issue fixed for 2 weeks with no activity.