/** * @covers Revision::getContent */ public function testGetContent_failure() { $rev = new Revision(['page' => $this->the_page->getId(), 'content_model' => $this->the_page->getContentModel(), 'text_id' => 123456789]); $this->assertNull($rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded."); // NOTE: check this twice, once for lazy initialization, and once with the cached value. $this->assertNull($rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded."); }
/** * @covers WikiPage::getContentModel */ public function testGetContentModel() { $page = $this->createPage("WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT); $page = new WikiPage($page->getTitle()); // NOTE: since the content model is not recorded in the database, // we expect to get the default, namely CONTENT_MODEL_WIKITEXT $this->assertEquals(CONTENT_MODEL_WIKITEXT, $page->getContentModel()); }
/** * @covers WikiPage::getContentModel */ public function testGetContentModel() { global $wgContentHandlerUseDB; if (!$wgContentHandlerUseDB) { $this->markTestSkipped('$wgContentHandlerUseDB is disabled'); } $page = $this->createPage("WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT); $page = new WikiPage($page->getTitle()); $this->assertEquals(CONTENT_MODEL_JAVASCRIPT, $page->getContentModel()); }