MediaWiki  1.23.2
WikiPageTest_ContentHandlerUseDB.php
Go to the documentation of this file.
1 <?php
2 
9 
10  protected function setUp() {
11  parent::setUp();
12  $this->setMwGlobals( 'wgContentHandlerUseDB', false );
13 
14  $dbw = wfGetDB( DB_MASTER );
15 
16  $page_table = $dbw->tableName( 'page' );
17  $revision_table = $dbw->tableName( 'revision' );
18  $archive_table = $dbw->tableName( 'archive' );
19 
20  if ( $dbw->fieldExists( $page_table, 'page_content_model' ) ) {
21  $dbw->query( "alter table $page_table drop column page_content_model" );
22  $dbw->query( "alter table $revision_table drop column rev_content_model" );
23  $dbw->query( "alter table $revision_table drop column rev_content_format" );
24  $dbw->query( "alter table $archive_table drop column ar_content_model" );
25  $dbw->query( "alter table $archive_table drop column ar_content_format" );
26  }
27  }
28 
32  public function testGetContentModel() {
33  $page = $this->createPage( "WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT );
34 
35  $page = new WikiPage( $page->getTitle() );
36 
37  // NOTE: since the content model is not recorded in the database,
38  // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
39  $this->assertEquals( CONTENT_MODEL_WIKITEXT, $page->getContentModel() );
40  }
41 
45  public function testGetContentHandler() {
46  $page = $this->createPage( "WikiPageTest_testGetContentHandler", "some text", CONTENT_MODEL_JAVASCRIPT );
47 
48  // NOTE: since the content model is not recorded in the database,
49  // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
50  $page = new WikiPage( $page->getTitle() );
51  $this->assertEquals( 'WikitextContentHandler', get_class( $page->getContentHandler() ) );
52  }
53 }
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
WikiPageTest\createPage
createPage( $page, $text, $model=null)
Definition: WikiPageTest.php:82
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
WikiPageTest_ContentHandlerUseDB\setUp
setUp()
Definition: WikiPageTest_ContentHandlerUseDB.php:10
WikiPage
Class representing a MediaWiki article and history.
Definition: WikiPage.php:37
CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_WIKITEXT
Definition: Defines.php:283
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
WikiPageTest
@group ContentHandler @group Database ^— important, causes temporary tables to be used instead of the...
Definition: WikiPageTest.php:9
WikiPageTest_ContentHandlerUseDB\testGetContentModel
testGetContentModel()
@covers WikiPage::getContentModel
Definition: WikiPageTest_ContentHandlerUseDB.php:32
WikiPageTest_ContentHandlerUseDB\testGetContentHandler
testGetContentHandler()
@covers WikiPage::getContentHandler
Definition: WikiPageTest_ContentHandlerUseDB.php:45
CONTENT_MODEL_JAVASCRIPT
const CONTENT_MODEL_JAVASCRIPT
Definition: Defines.php:284
WikiPageTest_ContentHandlerUseDB
@group ContentHandler @group Database ^— important, causes temporary tables to be used instead of the...
Definition: WikiPageTest_ContentHandlerUseDB.php:8