mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Linker tests.
This commit is contained in:
27
tests/phpunit/ExtensionTest.php
Normal file
27
tests/phpunit/ExtensionTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @group bovender
|
||||
* @group Database
|
||||
*/
|
||||
class ExtensionTest extends LinkTitles\TestCase {
|
||||
|
||||
public function testParseOnEdit() {
|
||||
$this->setMwGlobals( [
|
||||
'wgLinkTitlesParseOnEdit' => true,
|
||||
'wgLinkTitlesParseOnRender' => false
|
||||
] );
|
||||
$pageId = $this->insertPage( 'test page', 'This page should link to the link target but not to test page' )['id'];
|
||||
$page = WikiPage::newFromId( $pageId );
|
||||
$this->assertSame( 'This page should link to the [[link target]] but not to test page', self::getPageText( $page ) );
|
||||
}
|
||||
|
||||
public function testDoNotParseOnEdit() {
|
||||
$this->setMwGlobals( [
|
||||
'wgLinkTitlesParseOnEdit' => false,
|
||||
'wgLinkTitlesParseOnRender' => false
|
||||
] );
|
||||
$pageId = $this->insertPage( 'test page', 'This page should not link to the link target' )['id'];
|
||||
$page = WikiPage::newFromId( $pageId );
|
||||
$this->assertSame( 'This page should not link to the link target', self::getPageText( $page ) );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user