X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FStorage%2FPreMcrRevisionStoreDbTest.php;h=687ad4f309a060859c2a9113d3bdd65695119831;hb=8ebd811f12f523ae3ffb5444001e38c59fe2f19b;hp=a27d2bb29e46cda8180df6e4e6ddea1207de5d8e;hpb=b5d0251882e79790cc5635d8d20eb8cd79976678;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/Storage/PreMcrRevisionStoreDbTest.php b/tests/phpunit/includes/Storage/PreMcrRevisionStoreDbTest.php index a27d2bb29e..687ad4f309 100644 --- a/tests/phpunit/includes/Storage/PreMcrRevisionStoreDbTest.php +++ b/tests/phpunit/includes/Storage/PreMcrRevisionStoreDbTest.php @@ -2,6 +2,7 @@ namespace MediaWiki\Tests\Storage; use InvalidArgumentException; +use MediaWiki\Storage\RevisionRecord; use Revision; use WikitextContent; @@ -29,114 +30,18 @@ class PreMcrRevisionStoreDbTest extends RevisionStoreDbTestBase { return $row; } - public function provideGetArchiveQueryInfo() { - yield [ - [ - 'tables' => [ 'archive' ], - 'fields' => array_merge( - $this->getDefaultArchiveFields(), - [ - 'ar_comment_text' => 'ar_comment', - 'ar_comment_data' => 'NULL', - 'ar_comment_cid' => 'NULL', - 'ar_user_text' => 'ar_user_text', - 'ar_user' => 'ar_user', - 'ar_actor' => 'NULL', - 'ar_content_format', - 'ar_content_model', - ] - ), - 'joins' => [], - ] - ]; - } - - public function provideGetQueryInfo() { - yield [ + protected function assertRevisionExistsInDatabase( RevisionRecord $rev ) { + // Legacy schema is still being written + $this->assertSelect( + [ 'revision', 'text' ], + [ 'count(*)' ], + [ 'rev_id' => $rev->getId(), 'rev_text_id > 0' ], + [ [ 1 ] ], [], - [ - 'tables' => [ 'revision' ], - 'fields' => array_merge( - $this->getDefaultQueryFields(), - $this->getCommentQueryFields(), - $this->getActorQueryFields(), - $this->getContentHandlerQueryFields() - ), - 'joins' => [], - ] - ]; - yield [ - [ 'page', 'user', 'text' ], - [ - 'tables' => [ 'revision', 'page', 'user', 'text' ], - 'fields' => array_merge( - $this->getDefaultQueryFields(), - $this->getCommentQueryFields(), - $this->getActorQueryFields(), - $this->getContentHandlerQueryFields(), - [ - 'page_namespace', - 'page_title', - 'page_id', - 'page_latest', - 'page_is_redirect', - 'page_len', - 'user_name', - 'old_text', - 'old_flags' - ] - ), - 'joins' => [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], - 'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ], - 'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ], - ], - ] - ]; - } - - public function provideGetSlotsQueryInfo() { - $db = wfGetDB( DB_REPLICA ); + [ 'text' => [ 'INNER JOIN', [ 'rev_text_id = old_id' ] ] ] + ); - yield [ - [], - [ - 'tables' => [ - 'slots' => 'revision', - ], - 'fields' => array_merge( - [ - 'slot_revision_id' => 'slots.rev_id', - 'slot_content_id' => 'NULL', - 'slot_origin' => 'slots.rev_id', - 'role_name' => $db->addQuotes( 'main' ), - ] - ), - 'joins' => [], - ] - ]; - yield [ - [ 'content' ], - [ - 'tables' => [ - 'slots' => 'revision', - ], - 'fields' => array_merge( - [ - 'slot_revision_id' => 'slots.rev_id', - 'slot_content_id' => 'NULL', - 'slot_origin' => 'slots.rev_id', - 'role_name' => $db->addQuotes( 'main' ), - 'content_size' => 'slots.rev_len', - 'content_sha1' => 'slots.rev_sha1', - 'content_address' => - 'CONCAT(' . $db->addQuotes( 'tt:' ) . ',slots.rev_text_id)', - 'model_name' => 'slots.rev_content_model', - ] - ), - 'joins' => [], - ] - ]; + parent::assertRevisionExistsInDatabase( $rev ); } public function provideInsertRevisionOn_failures() {