wiki.techinc.nl/tests/phpunit/includes/EditPageTest.php
Brion Vibber 0f78700c55 For bug 32617: lift some code out to a function - EditPage::extractSectionTitle - so it can be tested and fixed.
Added test cases, including one that fails thus demonstrating bug 32617.
2011-12-06 23:35:42 +00:00

33 lines
669 B
PHP

<?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"
)
);
}
}