content');
+ $this->assertEqual($f, '
content
', t('HTML corrector -- unclosed tag with attribute.'));
+
+ $f = _filter_htmlcorrector('
');
+ $this->assertEqual($f, '
', t('HTML corrector -- XHTML closing slash.'));
+
+ // TODO: Filters do not handle comments (issue #222926).
+ // $f = _filter_htmlcorrector('');
+ // $this->assertEqual($f, '', t('HTML corrector -- skiping comments.'));
+
+ // $f = _filter_htmlcorrector("", t('HTML corrector -- closing unclosed comments.'));
+ }
+
+
function createFormat($filter) {
$edit = array(
'name' => $this->randomName(),
@@ -233,4 +559,43 @@ class FilterTestCase extends DrupalWebTe
$this->drupalPost('admin/settings/filters/delete/' . $format->format, array(), t('Delete'));
}
}
+
+ /**
+ * Asserts that a text transformed to lowercase with HTML entities decoded does contains a given string.
+ * Otherwise fails the test with a given message, similar to all the SimpleTest assert* functions.
+ * Note that this does not remove nulls, newlines and other that could be used to obscure a tag or an attribute name.
+ * @param $haystack
+ * Text to look in.
+ * @param $needle
+ * Lowercase, plain text to look for.
+ * @param $message
+ * Message to display if failed.
+ * @param $group
+ * The group this message belongs to, defaults to 'Other'.
+ * @return
+ * TRUE on pass, FALSE on fail.
+ */
+ function assertNormalized($haystack, $needle, $message = '', $group = 'Other') {
+ return $this->assertTrue(strpos(strtolower(decode_entities($haystack)), $needle) !== FALSE, $message, $group);
+ }
+
+ /**
+ * Asserts that a text transformed to lowercase with HTML entities decoded does not contain a given string.
+ * Otherwise fails the test with a given message, similar to all the SimpleTest assert* functions.
+ * Note that this does not remove nulls, newlines and other that could be used to obscure a tag or an attribute name.
+ * @param $haystack
+ * Text to look in.
+ * @param $needle
+ * Lowercase, plain text to look for.
+ * @param $message
+ * Message to display if failed.
+ * @param $group
+ * The group this message belongs to, defaults to 'Other'.
+ * @return
+ * TRUE on pass, FALSE on fail.
+ */
+ function assertNoNormalized($haystack, $needle, $message = '', $group = 'Other') {
+ return $this->assertTrue(strpos(strtolower(decode_entities($haystack)), $needle) === FALSE, $message, $group);
+ }
+
}