function GeshiFilterAdministrationTest::test_tag_unicity in GeSHi Filter for syntax highlighting 6
Same name and namespace in other branches
- 7 geshifilter.test \GeshiFilterAdministrationTest::test_tag_unicity()
Check tag unicity: tags should differ between languages and from generic tags
File
- ./
geshifilter.test, line 92 - Tests for the GeSHi filter module.
Class
- GeshiFilterAdministrationTest
- Funcional tests for the GeSHi filter administration.
Code
function test_tag_unicity() {
// enable some languages first
variable_set('geshifilter_language_enabled_php', TRUE);
variable_set('geshifilter_language_enabled_python', TRUE);
// first round: without format specific tag options
variable_set('geshifilter_format_specific_options', FALSE);
variable_set('geshifilter_tags', 'code blockcode generictag');
// a language tag should differ from the generic tags
$form_values = array(
'geshifilter_language_tags_php' => 'php generictag',
);
$this
->drupalPost('admin/settings/geshifilter/languages', $form_values, t('Save configuration'));
$this
->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ from generic tags (with generic tag options)'));
// language tags should differ between languages
$form_values = array(
'geshifilter_language_tags_php' => 'php languagetag',
'geshifilter_language_tags_python' => 'languagetag python',
);
$this
->drupalPost('admin/settings/geshifilter/languages/all', $form_values, t('Save configuration'));
$this
->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ between languages (with generic tag options)'));
// second round: with format specific tag options
variable_set('geshifilter_format_specific_options', TRUE);
variable_set('geshifilter_tags_' . $this->input_format_id, 'code blockcode generictag');
// a language tag should differ from the generic tags
$form_values = array(
'geshifilter_language_tags_php_' . $this->input_format_id => 'php generictag',
);
$this
->drupalPost('admin/settings/filters/' . $this->input_format_id . '/configure', $form_values, t('Save configuration'));
$this
->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ from generic tags (with format specific tag options)'));
// language tags should differ between languages
$form_values = array(
'geshifilter_language_tags_php_' . $this->input_format_id => 'php languagetag',
'geshifilter_language_tags_python_' . $this->input_format_id => 'languagetag python',
);
$this
->drupalPost('admin/settings/filters/' . $this->input_format_id . '/configure', $form_values, t('Save configuration'));
$this
->assertText(t('The language tags should differ between languages and from the generic tags.'), t('Language tags should differ between languages (with format specific tag options)'));
}