Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / page / WikiPageTestContentHandlerUseDB.php
blob3db7628090175f676d6cc6db541c8550f0ce5273
1 <?php
3 /**
4 * @group ContentHandler
5 * @group Database
6 * ^--- important, causes temporary tables to be used instead of the real database
7 */
8 class WikiPageTestContentHandlerUseDB extends WikiPageTest {
10 protected function setUp() {
11 parent::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" );
29 /**
30 * @covers WikiPage::getContentModel
32 public function testGetContentModel() {
33 $page = $this->createPage(
34 "WikiPageTest_testGetContentModel",
35 "some text",
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() );
46 /**
47 * @covers WikiPage::getContentHandler
49 public function testGetContentHandler() {
50 $page = $this->createPage(
51 "WikiPageTest_testGetContentHandler",
52 "some text",
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() ) );