Rename Delimiters to Splitter; add tests.

This commit is contained in:
Daniel Kraus
2017-08-27 22:32:32 +02:00
parent 3f2141e6c7
commit 1e27f47750
5 changed files with 43 additions and 33 deletions

View File

@ -0,0 +1,31 @@
<?php
/**
* @group bovender
*/
class SplitterTest extends MediaWikiTestCase {
/**
* @dataProvider provideSplitData
*/
public function testSplit( $input, $expectedOutput ) {
$splitter = LinkTitles\Splitter::default();
$this->assertSame( $expectedOutput, $splitter->split( $input ) );
}
// TODO: Add more examples.
public static function provideSplitData() {
return [
[
'this may be linked [[this may not be linked]]',
[ 'this may be linked ', '[[this may not be linked]]', '' ]
],
[
'this may be linked <gallery>this may not be linked</gallery>',
[ 'this may be linked ', '<gallery>this may not be linked</gallery>', '' ]
],
[
'this may be linked {{mytemplate|param={{transcluded}}}}',
[ 'this may be linked ', '{{mytemplate|param={{transcluded}}}}', '' ]
],
];
}
}