1 filter.test | FilterCRUDTestCase::verifyFilters($format) |
Verifies that filters are properly stored for a text format.
File
- core/
modules/ filter/ tests/ filter.test, line 115 - Tests for filter.module.
Class
- FilterCRUDTestCase
- Tests for text format and filter CRUD operations.
Code
function verifyFilters($format) {
// Verify filter database records.
$config_filters = (object) config_get('filter.format.' . $format->format, 'filters');
$format_filters = $format->filters;
$all_filter_info = filter_get_filters();
foreach ($config_filters as $name => $config_filter) {
$config_filter = (object) $config_filter;
$t_args = array('%format' => $format->name, '%filter' => $name);
// Verify that filter status is properly stored.
$this->assertEqual($config_filter->status, $format_filters[$name]->status, format_string('Proper status for %filter in text format %format in config.', $t_args));
// Verify that filter settings were properly stored.
$this->assertEqual($config_filter->settings, $format_filters[$name]->settings, format_string('Proper filter settings for %filter in text format %format in config.', $t_args));
// Verify that each filter has a module name assigned.
$this->assertEqual($config_filter->module, $all_filter_info[$name]['module'], format_string('Module name assigned for %filter in text format %format.', $t_args));
// Remove the filter from the copy of saved $format to check whether all
// filters have been processed later.
unset($format_filters[$name]);
}
// Verify that all filters have been processed.
$this->assertTrue(empty($format_filters), 'Config contains values for all filters in the saved format.');
}