2 use MediaWiki\MediaWikiServices
;
3 use MediaWiki\Storage\SlotRecord
;
4 use MediaWiki\Storage\SqlBlobStore
;
5 use MediaWiki\Tests\Storage\PreMcrSchemaOverride
;
8 * Test class for page archiving, using the pre-MCR schema.
10 * @group ContentHandler
12 * ^--- important, causes temporary tables to be used instead of the real database
15 * ^--- important, causes tests not to fail with timeout
17 class PageArchivePreMcrTest
extends PageArchiveTestBase
{
19 use PreMcrSchemaOverride
;
22 * @covers PageArchive::getTextFromRow
24 public function testGetTextFromRow() {
25 $this->hideDeprecated( PageArchive
::class . '::getTextFromRow' );
27 /** @var SqlBlobStore $blobStore */
28 $blobStore = MediaWikiServices
::getInstance()->getBlobStore();
30 $textId = $blobStore->getTextIdFromAddress(
31 $this->firstRev
->getSlot( SlotRecord
::MAIN
)->getAddress()
34 $row = (object)[ 'ar_text_id' => $textId ];
35 $text = $this->archivedPage
->getTextFromRow( $row );
36 $this->assertSame( 'testing', $text );
39 protected function getExpectedArchiveRows() {
40 /** @var SqlBlobStore $blobStore */
41 $blobStore = MediaWikiServices
::getInstance()->getBlobStore();
45 'ar_minor_edit' => '0',
47 'ar_user_text' => $this->ipEditor
,
51 'ar_rev_id' => strval( $this->ipRev
->getId() ),
52 'ar_timestamp' => $this->db
->timestamp( $this->ipRev
->getTimestamp() ),
53 'ar_sha1' => '0qdrpxl537ivfnx4gcpnzz0285yxryy',
54 'ar_page_id' => strval( $this->ipRev
->getPageId() ),
55 'ar_comment_text' => 'just a test',
56 'ar_comment_data' => null,
57 'ar_comment_cid' => null,
58 'ar_content_format' => null,
59 'ar_content_model' => null,
62 'ar_namespace' => '0',
63 'ar_title' => 'PageArchiveTest_thePage',
64 'ar_text_id' => (string)$blobStore->getTextIdFromAddress(
65 $this->ipRev
->getSlot( SlotRecord
::MAIN
)->getAddress()
67 'ar_parent_id' => strval( $this->ipRev
->getParentId() ),
70 'ar_minor_edit' => '0',
71 'ar_user' => (string)$this->getTestUser()->getUser()->getId(),
72 'ar_user_text' => $this->getTestUser()->getUser()->getName(),
76 'ar_rev_id' => strval( $this->firstRev
->getId() ),
77 'ar_timestamp' => $this->db
->timestamp( $this->firstRev
->getTimestamp() ),
78 'ar_sha1' => 'pr0s8e18148pxhgjfa0gjrvpy8fiyxc',
79 'ar_page_id' => strval( $this->firstRev
->getPageId() ),
80 'ar_comment_text' => 'testing',
81 'ar_comment_data' => null,
82 'ar_comment_cid' => null,
83 'ar_content_format' => null,
84 'ar_content_model' => null,
87 'ar_namespace' => '0',
88 'ar_title' => 'PageArchiveTest_thePage',
89 'ar_text_id' => (string)$blobStore->getTextIdFromAddress(
90 $this->firstRev
->getSlot( SlotRecord
::MAIN
)->getAddress()
92 'ar_parent_id' => '0',