public function CurrentSearchBugFixTestCase::testCurrentSearchTextEncoding in Facet API 7.2
Same name and namespace in other branches
- 7 contrib/current_search/tests/current_search.test \CurrentSearchBugFixTestCase::testCurrentSearchTextEncoding()
Tests bug fixed at http://drupal.org/node/1751514.
See also
http://drupal.org/node/1751514
http://drupal.org/node/1741444
File
- contrib/
current_search/ tests/ current_search.test, line 181 - Test cases for the Current Search Blocks module.
Class
- CurrentSearchBugFixTestCase
- Test cases for operations taken through the admin UI.
Code
public function testCurrentSearchTextEncoding() {
$raw_text = '<test>';
$variables = array(
'text' => $raw_text,
'wrapper' => 0,
);
// Test that the variable is escaped using check_plain().
$variables['options'] = array(
'html' => FALSE,
);
$sanitized_text = theme('current_search_text', $variables);
$this
->assertEqual(check_plain($raw_text), $sanitized_text, t('Text is properly sanitized by the theme_current_search_text() function.'), 'Current Search Blocks');
// Test that the HTML is not double encoded.
$variables['options'] = array(
'html' => TRUE,
);
$unsanitized_text = theme('current_search_text', $variables);
$this
->assertEqual($raw_text, $unsanitized_text, t('HTML is not double encoded by the theme_current_search_text() function.'), 'Current Search Blocks');
}