Introduce per-schema unit tests for revision storage.
[lhc/web/wiklou.git] / tests / phpunit / includes / Storage / PreMcrRevisionStoreDbTest.php
1 <?php
2 namespace MediaWiki\Tests\Storage;
3
4 /**
5 * Tests RevisionStore against the pre-MCR DB schema.
6 *
7 * @covers \MediaWiki\Storage\RevisionStore
8 *
9 * @group RevisionStore
10 * @group Storage
11 * @group Database
12 * @group medium
13 */
14 class PreMcrRevisionStoreDbTest extends RevisionStoreDbTestBase {
15
16 use PreMcrSchemaOverride;
17
18 public function provideGetArchiveQueryInfo() {
19 yield [
20 [
21 'tables' => [ 'archive' ],
22 'fields' => array_merge(
23 $this->getDefaultArchiveFields(),
24 [
25 'ar_comment_text' => 'ar_comment',
26 'ar_comment_data' => 'NULL',
27 'ar_comment_cid' => 'NULL',
28 'ar_user_text' => 'ar_user_text',
29 'ar_user' => 'ar_user',
30 'ar_actor' => 'NULL',
31 'ar_content_format',
32 'ar_content_model',
33 ]
34 ),
35 'joins' => [],
36 ]
37 ];
38 }
39
40 public function provideGetQueryInfo() {
41 yield [
42 [],
43 [
44 'tables' => [ 'revision' ],
45 'fields' => array_merge(
46 $this->getDefaultQueryFields(),
47 $this->getCommentQueryFields(),
48 $this->getActorQueryFields(),
49 $this->getContentHandlerQueryFields()
50 ),
51 'joins' => [],
52 ]
53 ];
54 yield [
55 [ 'page', 'user', 'text' ],
56 [
57 'tables' => [ 'revision', 'page', 'user', 'text' ],
58 'fields' => array_merge(
59 $this->getDefaultQueryFields(),
60 $this->getCommentQueryFields(),
61 $this->getActorQueryFields(),
62 $this->getContentHandlerQueryFields(),
63 [
64 'page_namespace',
65 'page_title',
66 'page_id',
67 'page_latest',
68 'page_is_redirect',
69 'page_len',
70 'user_name',
71 'old_text',
72 'old_flags'
73 ]
74 ),
75 'joins' => [
76 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ],
77 'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
78 'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ],
79 ],
80 ]
81 ];
82 }
83
84 }