mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Rename Delimiters to Splitter; add tests.
This commit is contained in:
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @group bovender
|
||||
*/
|
||||
class DelimitersTest extends MediaWikiTestCase {
|
||||
/**
|
||||
* @dataProvider provideSplitData
|
||||
*/
|
||||
public function testSplit( $input, $output ) {
|
||||
|
||||
}
|
||||
|
||||
public static function provideSplitData() {
|
||||
return [
|
||||
[
|
||||
'this may be linked [[this may not be linked]]',
|
||||
[ 'this may be linked', '[[this may not be linked]]']
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
31
tests/phpunit/SplitterTest.php
Normal file
31
tests/phpunit/SplitterTest.php
Normal 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}}}}', '' ]
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user