TestTextFormatConfiguration.test in Configuration Management 7.2
File
tests/handlers/TestTextFormatConfiguration.test
View source
<?php
class TestTextFormatConfiguration extends ConfigurationHandlerBaseTestCase {
public static function getInfo() {
return array(
'name' => t('Handler: TextFormatConfiguration'),
'description' => t('Test the configuration API for text formats configurations'),
'group' => t('Configuration'),
);
}
protected function configToImport() {
return array(
'text_format.custom',
);
}
protected function configToExport() {
return array(
'text_format.custom_plain_text',
);
}
protected function configToModify() {
return array(
'text_format.custom',
);
}
protected function isModified($config) {
$modified = FALSE;
filter_formats_reset();
$format = filter_format_load('custom');
$modified = $format->name == 'modified';
return $modified;
}
protected function savedInActiveStore() {
$format = filter_format_load('custom');
return !empty($format->format);
}
protected function createConfigToExport() {
$custom_plain_text_format = array(
'format' => 'custom_plain_text',
'name' => 'Custom Plain text',
'weight' => 10,
'filters' => array(
'filter_html_escape' => array(
'weight' => 0,
'status' => 1,
),
'filter_url' => array(
'weight' => 1,
'status' => 1,
),
'filter_autop' => array(
'weight' => 2,
'status' => 1,
),
),
);
$custom_plain_text_format = (object) $custom_plain_text_format;
filter_format_save($custom_plain_text_format);
}
protected function modifyConfiguration() {
$web_user = $this
->drupalCreateUser(array(
'administer filters',
));
$this
->drupalLogin($web_user);
$edit = array();
$edit['name'] = 'modified';
$this
->drupalPost('admin/config/content/formats/custom', $edit, t('Save configuration'));
filter_formats_reset();
}
}