summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/EditPageTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/EditPageTest.php')
-rw-r--r--tests/phpunit/includes/EditPageTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php
new file mode 100644
index 00000000..e98e9707
--- /dev/null
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -0,0 +1,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"
+ )
+ );
+ }
+}