For bug 32617: lift some code out to a function - EditPage::extractSectionTitle ...
[lhc/web/wiklou.git] / tests / phpunit / includes / EditPageTest.php
1 <?php
2
3 class EditPageTest extends MediaWikiTestCase {
4
5 /**
6 * @dataProvider dataExtractSectionTitle
7 */
8 function testExtractSectionTitle( $section, $title ) {
9 $extracted = EditPage::extractSectionTitle( $section );
10 $this->assertEquals( $title, $extracted );
11 }
12
13 function dataExtractSectionTitle() {
14 return array(
15 array(
16 "== Test ==\n\nJust a test section.",
17 "Test"
18 ),
19 array(
20 "An initial section, no header.",
21 false
22 ),
23 array(
24 "An initial section with a fake heder (bug 32617)\n\n== Test == ??\nwtf",
25 false
26 ),
27 array(
28 "== Section ==\nfollowed by a fake == Non-section == ??\nnoooo",
29 "Section"
30 )
31 );
32 }
33 }