dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Introduce per-schema unit tests for revision storage."
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
page
/
WikiPageDbTestBase.php
diff --git
a/tests/phpunit/includes/page/WikiPageDbTestBase.php
b/tests/phpunit/includes/page/WikiPageDbTestBase.php
index
40c4e1e
..
cc20b6b
100644
(file)
--- a/
tests/phpunit/includes/page/WikiPageDbTestBase.php
+++ b/
tests/phpunit/includes/page/WikiPageDbTestBase.php
@@
-30,10
+30,29
@@
abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
'iwlinks' ] );
}
'iwlinks' ] );
}
+ /**
+ * @return int
+ */
+ abstract protected function getMcrMigrationStage();
+
+ /**
+ * @return string[]
+ */
+ abstract protected function getMcrTablesToReset();
+
protected function setUp() {
parent::setUp();
protected function setUp() {
parent::setUp();
+
+ $this->tablesUsed += $this->getMcrTablesToReset();
+
$this->setMwGlobals( 'wgContentHandlerUseDB', $this->getContentHandlerUseDB() );
$this->setMwGlobals( 'wgContentHandlerUseDB', $this->getContentHandlerUseDB() );
+ $this->setMwGlobals(
+ 'wgMultiContentRevisionSchemaMigrationStage',
+ $this->getMcrMigrationStage()
+ );
$this->pagesToDelete = [];
$this->pagesToDelete = [];
+
+ $this->overrideMwServices();
}
protected function tearDown() {
}
protected function tearDown() {
@@
-96,6
+115,8
@@
abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
* @covers WikiPage::doEditUpdates
*/
public function testDoEditContent() {
* @covers WikiPage::doEditUpdates
*/
public function testDoEditContent() {
+ $this->setMwGlobals( 'wgPageCreationLog', true );
+
$page = $this->newPage( __METHOD__ );
$title = $page->getTitle();
$page = $this->newPage( __METHOD__ );
$title = $page->getTitle();
@@
-108,13
+129,21
@@
abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
$page->doEditContent( $content, "[[testing]] 1" );
$page->doEditContent( $content, "[[testing]] 1" );
+ $id = $page->getId();
+
+ // Test page creation logging
+ $this->assertSelect(
+ 'logging',
+ [ 'log_type', 'log_action' ],
+ [ 'log_page' => $id ],
+ [ [ 'create', 'create' ] ]
+ );
+
$this->assertTrue( $title->getArticleID() > 0, "Title object should have new page id" );
$this->assertTrue( $title->getArticleID() > 0, "Title object should have new page id" );
- $this->assertTrue( $
page->getId()
> 0, "WikiPage should have new page id" );
+ $this->assertTrue( $
id
> 0, "WikiPage should have new page id" );
$this->assertTrue( $title->exists(), "Title object should indicate that the page now exists" );
$this->assertTrue( $page->exists(), "WikiPage object should indicate that the page now exists" );
$this->assertTrue( $title->exists(), "Title object should indicate that the page now exists" );
$this->assertTrue( $page->exists(), "WikiPage object should indicate that the page now exists" );
- $id = $page->getId();
-
# ------------------------
$dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'pagelinks', '*', [ 'pl_from' => $id ] );
# ------------------------
$dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'pagelinks', '*', [ 'pl_from' => $id ] );