summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/EditPageTest.php
blob: e98e97075f7c2b3e3533d4dad19dfdb985e870bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

class EditPageTest extends MediaWikiTestCase {

	/**
	 * @dataProvider dataExtractSectionTitle
	 */
	function testExtractSectionTitle( $section, $title ) {
		$extracted = EditPage::extractSectionTitle( $section );
		$this->assertEquals( $title, $extracted );
	}

	function dataExtractSectionTitle() {
		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"
			)
		);
	}
}