4 * @group ContentHandler
6 * ^--- important, causes temporary tables to be used instead of the real database
8 class WikiPageTest_ContentHandlerUseDB
extends WikiPageTest
{
12 $this->setMwGlobals( 'wgContentHandlerUseDB', false );
14 $dbw = wfGetDB( DB_MASTER
);
16 $page_table = $dbw->tableName( 'page' );
17 $revision_table = $dbw->tableName( 'revision' );
18 $archive_table = $dbw->tableName( 'archive' );
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" );
29 public function testGetContentModel() {
30 $page = $this->createPage( "WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT
);
32 $page = new WikiPage( $page->getTitle() );
34 // NOTE: since the content model is not recorded in the database,
35 // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
36 $this->assertEquals( CONTENT_MODEL_WIKITEXT
, $page->getContentModel() );
39 public function testGetContentHandler() {
40 $page = $this->createPage( "WikiPageTest_testGetContentHandler", "some text", CONTENT_MODEL_JAVASCRIPT
);
42 // NOTE: since the content model is not recorded in the database,
43 // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
44 $page = new WikiPage( $page->getTitle() );
45 $this->assertEquals( 'WikitextContentHandler', get_class( $page->getContentHandler() ) );