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