4 * @group ContentHandler
6 * ^--- important, causes temporary tables to be used instead of the real database
8 class WikiPageTestContentHandlerUseDB
extends WikiPageTest
{
10 protected function setUp() {
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" );
30 * @covers WikiPage::getContentModel
32 public function testGetContentModel() {
33 $page = $this->createPage(
34 "WikiPageTest_testGetContentModel",
36 CONTENT_MODEL_JAVASCRIPT
39 $page = new WikiPage( $page->getTitle() );
41 // NOTE: since the content model is not recorded in the database,
42 // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
43 $this->assertEquals( CONTENT_MODEL_WIKITEXT
, $page->getContentModel() );
47 * @covers WikiPage::getContentHandler
49 public function testGetContentHandler() {
50 $page = $this->createPage(
51 "WikiPageTest_testGetContentHandler",
53 CONTENT_MODEL_JAVASCRIPT
56 // NOTE: since the content model is not recorded in the database,
57 // we expect to get the default, namely CONTENT_MODEL_WIKITEXT
58 $page = new WikiPage( $page->getTitle() );
59 $this->assertEquals( 'WikitextContentHandler', get_class( $page->getContentHandler() ) );