2011-12-06 23:35:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
2012-03-15 15:38:11 +00:00
|
|
|
/**
|
|
|
|
|
* @group Editing
|
|
|
|
|
*/
|
2011-12-06 23:35:42 +00:00
|
|
|
class EditPageTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider provideExtractSectionTitle
|
2011-12-06 23:35:42 +00:00
|
|
|
*/
|
|
|
|
|
function testExtractSectionTitle( $section, $title ) {
|
|
|
|
|
$extracted = EditPage::extractSectionTitle( $section );
|
|
|
|
|
$this->assertEquals( $title, $extracted );
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function provideExtractSectionTitle() {
|
2011-12-06 23:35:42 +00:00
|
|
|
return array(
|
|
|
|
|
array(
|
|
|
|
|
"== Test ==\n\nJust a test section.",
|
|
|
|
|
"Test"
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"An initial section, no header.",
|
|
|
|
|
false
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"An initial section with a fake heder (bug 32617)\n\n== Test == ??\nwtf",
|
|
|
|
|
false
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"== Section ==\nfollowed by a fake == Non-section == ??\nnoooo",
|
|
|
|
|
"Section"
|
2012-03-15 15:38:11 +00:00
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"== Section== \t\r\n followed by whitespace (bug 35051)",
|
|
|
|
|
'Section',
|
|
|
|
|
),
|
2011-12-06 23:35:42 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|