public function FeedsMapperFormatConfig::testTaxonomyDescriptionTextFormat in Feeds 7.2
Tests if text format can be set for taxonomy descriptions.
File
- tests/
feeds_mapper_format_config.test, line 202 - Contains FeedsMapperFormatConfig.
Class
- FeedsMapperFormatConfig
- Class for testing "Text format" mapping configuration on text fields.
Code
public function testTaxonomyDescriptionTextFormat() {
// Create a vocabulary.
$edit = array(
'name' => 'Tags',
'machine_name' => 'tags',
);
$this
->drupalPost('admin/structure/taxonomy/add', $edit, 'Save');
// Create a new filter format.
$format = drupal_strtolower($this
->randomName());
$edit = array(
'format' => $format,
'name' => $this
->randomName(),
// Authenticated users.
'roles[2]' => TRUE,
);
$this
->drupalPost('admin/config/content/formats/add', $edit, t('Save configuration'));
// Create a taxonomy term importer.
$this
->createImporterConfiguration();
$this
->setSettings('syndication', NULL, array(
'content_type' => '',
'import_period' => FEEDS_SCHEDULE_NEVER,
));
$this
->setPlugin('syndication', 'FeedsFileFetcher');
$this
->setPlugin('syndication', 'FeedsCSVParser');
$this
->setPlugin('syndication', 'FeedsTermProcessor');
$this
->setSettings('syndication', 'FeedsTermProcessor', array(
'bundle' => 'tags',
));
$this
->addMappings('syndication', array(
0 => array(
'source' => 'title',
'target' => 'name',
),
1 => array(
'source' => 'body',
'target' => 'description',
'format' => $format,
),
));
// Import csv file.
$this
->importFile('syndication', $this
->absolutePath() . '/tests/feeds/content.csv');
$this
->assertText('Created 2 terms');
// Assert that the term description got the expected text format.
$term = taxonomy_term_load(1);
$this
->assertEqual($format, $term->format, 'The taxonomy term got the expected format.');
}