Reflow PHP files.

This commit is contained in:
Daniel Kraus
2018-11-15 20:17:59 +01:00
parent 5f52c665a2
commit 73f546a33d
4 changed files with 117 additions and 117 deletions

View File

@ -26,87 +26,87 @@
*/
class ExtensionTest extends LinkTitles\TestCase {
/**
/**
* @dataProvider provideParseOnEditData
*/
public function testParseOnEdit( $parseOnEdit, $input, $expectedOutput) {
$this->setMwGlobals( [
'wgLinkTitlesParseOnEdit' => $parseOnEdit,
'wgLinkTitlesParseOnRender' => !$parseOnEdit
] );
$pageId = $this->insertPage( 'test page', $input )['id'];
$page = WikiPage::newFromId( $pageId );
$this->assertSame( $expectedOutput, self::getPageText( $page ) );
}
*/
public function testParseOnEdit( $parseOnEdit, $input, $expectedOutput) {
$this->setMwGlobals( [
'wgLinkTitlesParseOnEdit' => $parseOnEdit,
'wgLinkTitlesParseOnRender' => !$parseOnEdit
] );
$pageId = $this->insertPage( 'test page', $input )['id'];
$page = WikiPage::newFromId( $pageId );
$this->assertSame( $expectedOutput, self::getPageText( $page ) );
}
public function provideParseOnEditData() {
return [
[
true, // parseOnEdit
'This page should link to the link target but not to test page',
'This page should link to the [[link target]] but not to test page'
],
[
false, // parseOnEdit
'This page should *not* link to the link target',
'This page should *not* link to the link target'
],
[
true, // parseOnEdit
'With __NOAUTOLINKS__, this page should not link to the link target',
'With __NOAUTOLINKS__, this page should not link to the link target'
],
];
}
public function provideParseOnEditData() {
return [
[
true, // parseOnEdit
'This page should link to the link target but not to test page',
'This page should link to the [[link target]] but not to test page'
],
[
false, // parseOnEdit
'This page should *not* link to the link target',
'This page should *not* link to the link target'
],
[
true, // parseOnEdit
'With __NOAUTOLINKS__, this page should not link to the link target',
'With __NOAUTOLINKS__, this page should not link to the link target'
],
];
}
/**
/**
* @dataProvider provideParseOnRenderData
*/
public function testParseOnRender( $parseOnRender, $input, $expectedOutput) {
$this->setMwGlobals( [
'wgLinkTitlesParseOnEdit' => false, // do not modify the page as we create it
'wgLinkTitlesParseOnRender' => $parseOnRender
] );
$title = $this->insertPage( 'test page', $input )['title'];
$page = new WikiPage( $title );
$output = $page->getParserOutput( new ParserOptions(), null, true );
$lines = explode( "\n", $output->getText() );
$this->assertRegexp( $expectedOutput, $lines[0] );
}
*/
public function testParseOnRender( $parseOnRender, $input, $expectedOutput) {
$this->setMwGlobals( [
'wgLinkTitlesParseOnEdit' => false, // do not modify the page as we create it
'wgLinkTitlesParseOnRender' => $parseOnRender
] );
$title = $this->insertPage( 'test page', $input )['title'];
$page = new WikiPage( $title );
$output = $page->getParserOutput( new ParserOptions(), null, true );
$lines = explode( "\n", $output->getText() );
$this->assertRegexp( $expectedOutput, $lines[0] );
}
public function provideParseOnRenderData() {
return [
[
true, // parseOnRender
'This page should link to the link target but not to the test page',
'_This page should link to the <a href=[^>]+>link target</a> but not to the test page_'
],
[
false, // parseOnRender
'This page should not link to the link target',
'_This page should not link to the link target_'
],
[
true, // parseOnRender
'__NOAUTOLINKS__With noautolinks magic word, this page should not link to the link target',
'_With noautolinks magic word, this page should not link to the link target_'
],
[
true, // parseOnRender
'__NOAUTOLINKS__With noautolinks magic word, <autolinks>link target in autolinks tag</autolinks> should be linked',
'_With noautolinks magic word, <a href=[^>]+>link target</a> in autolinks tag should be linked_'
],
[
true, // parseOnRender
'<noautolinks>In a noautolinks tag, link target should NOT be linked</noautolinks>',
'_In a noautolinks tag, link target should NOT be linked_'
],
[
true, // parseOnRender
'<noautolinks>In a noautolinks tag, <autolinks>link target in autolinks tag</autolinks> should be linked</noautolinks>',
'_In a noautolinks tag, <a href=[^>]+>link target</a> in autolinks tag should be linked_'
],
];
}
public function provideParseOnRenderData() {
return [
[
true, // parseOnRender
'This page should link to the link target but not to the test page',
'_This page should link to the <a href=[^>]+>link target</a> but not to the test page_'
],
[
false, // parseOnRender
'This page should not link to the link target',
'_This page should not link to the link target_'
],
[
true, // parseOnRender
'__NOAUTOLINKS__With noautolinks magic word, this page should not link to the link target',
'_With noautolinks magic word, this page should not link to the link target_'
],
[
true, // parseOnRender
'__NOAUTOLINKS__With noautolinks magic word, <autolinks>link target in autolinks tag</autolinks> should be linked',
'_With noautolinks magic word, <a href=[^>]+>link target</a> in autolinks tag should be linked_'
],
[
true, // parseOnRender
'<noautolinks>In a noautolinks tag, link target should NOT be linked</noautolinks>',
'_In a noautolinks tag, link target should NOT be linked_'
],
[
true, // parseOnRender
'<noautolinks>In a noautolinks tag, <autolinks>link target in autolinks tag</autolinks> should be linked</noautolinks>',
'_In a noautolinks tag, <a href=[^>]+>link target</a> in autolinks tag should be linked_'
],
];
}
}