class HtmlFormatterTest extends MediaWikiTestCase {
/**
* @dataProvider getHtmlData
- * @covers HtmlFormatter::getText
+ *
+ * @param string $input
+ * @param $expectedText
+ * @param array $expectedRemoved
+ * @param callable|bool $callback
*/
public function testTransform( $input, $expectedText,
$expectedRemoved = array(), $callback = false
array(
'<span title="" \' &"><Тест!></span> &<&&&&',
'<span title="" \' &"><Тест!></span> &<&&&&',
+ array(),
+ $removeTags, // Have some rules to trigger a DOM parse
),
// https://bugzilla.wikimedia.org/show_bug.cgi?id=53086
array(
),
);
}
+
+ public function testQuickProcessing() {
+ $f = new MockHtmlFormatter( 'foo' );
+ $f->filterContent();
+ $this->assertFalse( $f->hasDoc, 'HtmlFormatter should not needlessly parse HTML' );
+ }
+}
+
+class MockHtmlFormatter extends HtmlFormatter {
+ public $hasDoc = false;
+
+ public function getDoc() {
+ $this->hasDoc = true;
+ return parent::getDoc();
+ }
}