X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FRevisionDbTestBase.php;h=61f18021dedc5e34997c205fca1db78f4f58f977;hb=008062c87cb4b400fcb5df0caf137bf2964a28e3;hp=427a95e656c83ebd70441abf012149cba9119531;hpb=cf3bdd40a3fd22045703c1e188115fc87386fa65;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/RevisionDbTestBase.php b/tests/phpunit/includes/RevisionDbTestBase.php index 427a95e656..61f18021de 100644 --- a/tests/phpunit/includes/RevisionDbTestBase.php +++ b/tests/phpunit/includes/RevisionDbTestBase.php @@ -108,7 +108,9 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { } if ( !isset( $props['user_text'] ) ) { - $props['user_text'] = 'Tester'; + $user = $this->getTestUser()->getUser(); + $props['user_text'] = $user->getName(); + $props['user'] = $user->getId(); } if ( !isset( $props['user'] ) ) { @@ -243,7 +245,6 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { 'rev_id', 'rev_page', 'rev_text_id', - 'rev_user', 'rev_minor_edit', 'rev_deleted', 'rev_len', @@ -257,7 +258,6 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { strval( $textId ), '0', '0', - '0', '13', strval( $parentId ), 's0ngbdoxagreuf2vjtuxzwdz64n29xm', @@ -396,7 +396,9 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { $store = new RevisionStore( $services->getDBLoadBalancer(), $services->getService( '_SqlBlobStore' ), - $services->getMainWANObjectCache() + $services->getMainWANObjectCache(), + $services->getCommentStore(), + $services->getActorMigration() ); $store->setContentHandlerUseDB( $this->getContentHandlerUseDB() ); @@ -744,15 +746,17 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { // test it --------------------------------- $since = $revisions[$sinceIdx]->getTimestamp(); + $revQuery = Revision::getQueryInfo(); $allRows = iterator_to_array( $dbw->select( - 'revision', - [ 'rev_id', 'rev_timestamp', 'rev_user' ], + $revQuery['tables'], + [ 'rev_id', 'rev_timestamp', 'rev_user' => $revQuery['fields']['rev_user'] ], [ 'rev_page' => $page->getId(), //'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $since ) ) ], __METHOD__, - [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ] + [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ], + $revQuery['joins'] ) ); $wasLast = Revision::userWasLastToEdit( $dbw, $page->getId(), $userA->getId(), $since ); @@ -837,9 +841,9 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { public function provideGetContentHandler() { // NOTE: we expect the help namespace to always contain wikitext return [ - [ 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ], - [ 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ], - [ serialize( 'hello world' ), 'Dummy:Hello', null, null, 'DummyContentHandlerForTesting' ], + [ 'hello world', 'Help:Hello', null, null, WikitextContentHandler::class ], + [ 'hello world', 'User:hello/there.css', null, null, CssContentHandler::class ], + [ serialize( 'hello world' ), 'Dummy:Hello', null, null, DummyContentHandlerForTesting::class ], ]; } @@ -902,7 +906,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { 'text_id' => 123456789, // not in the test DB ] ); - MediaWiki\suppressWarnings(); // bad text_id will trigger a warning. + Wikimedia\suppressWarnings(); // bad text_id will trigger a warning. $this->assertNull( $rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded." ); @@ -911,7 +915,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { $this->assertNull( $rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded." ); - MediaWiki\suppressWarnings( 'end' ); + Wikimedia\restoreWarnings(); } public function provideGetSize() {