mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts
synced 2024-11-30 10:55:14 +00:00
38 lines
1.5 KiB
PHP
38 lines
1.5 KiB
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* @group TextExtracts
|
||
|
* @group Broken
|
||
|
* Disabled for now due to Jenkins weirdness
|
||
|
*/
|
||
|
class ExtractFormatterTest extends MediaWikiTestCase {
|
||
|
/**
|
||
|
* @dataProvider provideExtracts
|
||
|
*/
|
||
|
public function testExtracts( $expected, $wikiText, $plainText ) {
|
||
|
$title = Title::newFromText( 'Test' );
|
||
|
$po = new ParserOptions();
|
||
|
$po->setEditSection( true );
|
||
|
$parser = new Parser();
|
||
|
$text = $parser->parse( $wikiText, $title, $po )->getText();
|
||
|
$fmt = new ExtractFormatter( $text, $plainText );
|
||
|
$fmt->remove( '.metadata' ); // Will be added via $wgExtractsRemoveClasses on WMF
|
||
|
$text = trim( $fmt->getText() );
|
||
|
$this->assertEquals( $expected, $text );
|
||
|
}
|
||
|
|
||
|
public function provideExtracts() {
|
||
|
$dutch = "'''Dutch''' (<span class=\"unicode haudio\" style=\"white-space:nowrap;\"><span class=\"fn\">"
|
||
|
. "[[File:Loudspeaker.svg|11px|link=File:nl-Nederlands.ogg|About this sound]] [[:Media:nl-Nederlands.ogg|''Nederlands'']]"
|
||
|
. "</span> <small class=\"metadata audiolinkinfo\" style=\"cursor:help;\">([[Wikipedia:Media help|<span style=\"cursor:help;\">"
|
||
|
. "help</span>]]·[[:File:nl-Nederlands.ogg|<span style=\"cursor:help;\">info</span>]])</small></span>) is a"
|
||
|
. " [[West Germanic languages|West Germanic language]] and the native language of most of the population of the [[Netherlands]]";
|
||
|
return array(
|
||
|
array(
|
||
|
"Dutch ( Nederlands ) is a West Germanic language and the native language of most of the population of the Netherlands",
|
||
|
$dutch,
|
||
|
true,
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|