3 namespace MediaWiki\Tests\Revision
;
8 * Tests RevisionStore against the pre-MCR, pre-ContentHandler DB schema.
10 * @covers \MediaWiki\Revision\RevisionStore
12 * @group RevisionStore
17 class NoContentModelRevisionStoreDbTest
extends RevisionStoreDbTestBase
{
19 use PreMcrSchemaOverride
;
21 protected function getContentHandlerUseDB() {
25 protected function revisionToRow( Revision
$rev, $options = [ 'page', 'user', 'comment' ] ) {
26 $row = parent
::revisionToRow( $rev, $options );
28 $row->rev_text_id
= (string)$rev->getTextId();
33 public function provideGetArchiveQueryInfo() {
36 'tables' => [ 'archive' ],
37 'fields' => array_merge(
38 $this->getDefaultArchiveFields(),
40 'ar_comment_text' => 'ar_comment',
41 'ar_comment_data' => 'NULL',
42 'ar_comment_cid' => 'NULL',
43 'ar_user_text' => 'ar_user_text',
44 'ar_user' => 'ar_user',
53 public function provideGetQueryInfo() {
57 'tables' => [ 'revision' ],
58 'fields' => array_merge(
59 $this->getDefaultQueryFields(),
60 $this->getCommentQueryFields(),
61 $this->getActorQueryFields()
69 'tables' => [ 'revision', 'page' ],
70 'fields' => array_merge(
71 $this->getDefaultQueryFields(),
72 $this->getCommentQueryFields(),
73 $this->getActorQueryFields(),
84 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ],
91 'tables' => [ 'revision', 'user' ],
92 'fields' => array_merge(
93 $this->getDefaultQueryFields(),
94 $this->getCommentQueryFields(),
95 $this->getActorQueryFields(),
101 'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
108 'tables' => [ 'revision', 'text' ],
109 'fields' => array_merge(
110 $this->getDefaultQueryFields(),
111 $this->getCommentQueryFields(),
112 $this->getActorQueryFields(),
119 'text' => [ 'JOIN', [ 'rev_text_id=old_id' ] ],
125 public function provideGetSlotsQueryInfo() {
126 $db = wfGetDB( DB_REPLICA
);
132 'slots' => 'revision',
134 'fields' => array_merge(
136 'slot_revision_id' => 'slots.rev_id',
137 'slot_content_id' => 'NULL',
138 'slot_origin' => 'slots.rev_id',
139 'role_name' => $db->addQuotes( SlotRecord
::MAIN
),
149 'slots' => 'revision',
151 'fields' => array_merge(
153 'slot_revision_id' => 'slots.rev_id',
154 'slot_content_id' => 'NULL',
155 'slot_origin' => 'slots.rev_id',
156 'role_name' => $db->addQuotes( SlotRecord
::MAIN
),
157 'content_size' => 'slots.rev_len',
158 'content_sha1' => 'slots.rev_sha1',
160 $db->buildConcat( [ $db->addQuotes( 'tt:' ), 'slots.rev_text_id' ] ),
161 'model_name' => 'NULL',
169 public function provideNewMutableRevisionFromArray() {
170 foreach ( parent
::provideNewMutableRevisionFromArray() as $case ) {
174 yield
'Basic array, with page & id' => [
179 'timestamp' => '20171017114835',
180 'user_text' => '111.0.1.2',
182 'minor_edit' => false,
186 'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
187 'comment' => 'Goat Comment!',
193 * Conditions to use together with getSlotsQueryInfo() when selecting slot rows for a given
198 protected function getSlotRevisionConditions( $revId ) {
199 return [ 'rev_id' => $revId ];