Merge "SearchEngine: Hard deprecate SearchEngine::transformSearchTerm()"
[lhc/web/wiklou.git] / tests / phpunit / includes / page / PageArchiveMcrTest.php
1 <?php
2 use MediaWiki\MediaWikiServices;
3 use MediaWiki\Tests\Revision\McrSchemaOverride;
4
5 /**
6 * Test class for page archiving, using the new MCR schema.
7 *
8 * @group ContentHandler
9 * @group Database
10 * ^--- important, causes temporary tables to be used instead of the real database
11 *
12 * @group medium
13 * ^--- important, causes tests not to fail with timeout
14 */
15 class PageArchiveMcrTest extends PageArchiveTestBase {
16
17 use McrSchemaOverride;
18
19 /**
20 * @covers PageArchive::listRevisions
21 */
22 public function testListRevisions_slots() {
23 $revisions = $this->archivedPage->listRevisions();
24
25 $revisionStore = MediaWikiServices::getInstance()->getInstance()->getRevisionStore();
26 $slotsQuery = $revisionStore->getSlotsQueryInfo( [ 'content' ] );
27
28 foreach ( $revisions as $row ) {
29 $this->assertSelect(
30 $slotsQuery['tables'],
31 'count(*)',
32 [ 'slot_revision_id' => $row->ar_rev_id ],
33 [ [ 1 ] ],
34 [],
35 $slotsQuery['joins']
36 );
37 }
38 }
39
40 protected function getExpectedArchiveRows() {
41 return [
42 [
43 'ar_minor_edit' => '0',
44 'ar_user' => null,
45 'ar_user_text' => $this->ipEditor,
46 'ar_actor' => (string)User::newFromName( $this->ipEditor, false )->getActorId( $this->db ),
47 'ar_len' => '11',
48 'ar_deleted' => '0',
49 'ar_rev_id' => strval( $this->ipRev->getId() ),
50 'ar_timestamp' => $this->db->timestamp( $this->ipRev->getTimestamp() ),
51 'ar_sha1' => '0qdrpxl537ivfnx4gcpnzz0285yxryy',
52 'ar_page_id' => strval( $this->ipRev->getPageId() ),
53 'ar_comment_text' => 'just a test',
54 'ar_comment_data' => null,
55 'ar_comment_cid' => '2',
56 'ts_tags' => null,
57 'ar_id' => '2',
58 'ar_namespace' => '0',
59 'ar_title' => 'PageArchiveTest_thePage',
60 'ar_parent_id' => strval( $this->ipRev->getParentId() ),
61 ],
62 [
63 'ar_minor_edit' => '0',
64 'ar_user' => (string)$this->getTestUser()->getUser()->getId(),
65 'ar_user_text' => $this->getTestUser()->getUser()->getName(),
66 'ar_actor' => (string)$this->getTestUser()->getUser()->getActorId(),
67 'ar_len' => '7',
68 'ar_deleted' => '0',
69 'ar_rev_id' => strval( $this->firstRev->getId() ),
70 'ar_timestamp' => $this->db->timestamp( $this->firstRev->getTimestamp() ),
71 'ar_sha1' => 'pr0s8e18148pxhgjfa0gjrvpy8fiyxc',
72 'ar_page_id' => strval( $this->firstRev->getPageId() ),
73 'ar_comment_text' => 'testing',
74 'ar_comment_data' => null,
75 'ar_comment_cid' => '1',
76 'ts_tags' => null,
77 'ar_id' => '1',
78 'ar_namespace' => '0',
79 'ar_title' => 'PageArchiveTest_thePage',
80 'ar_parent_id' => '0',
81 ],
82 ];
83 }
84
85 }