2 use MediaWiki\MediaWikiServices
;
3 use MediaWiki\Storage\SqlBlobStore
;
4 use MediaWiki\Tests\Storage\PreMcrSchemaOverride
;
7 * Test class for page archiving, using the pre-MCR schema.
9 * @group ContentHandler
11 * ^--- important, causes temporary tables to be used instead of the real database
14 * ^--- important, causes tests not to fail with timeout
16 class PageArchivePreMcrTest
extends PageArchiveTestBase
{
18 use PreMcrSchemaOverride
;
21 * @covers PageArchive::getTextFromRow
23 public function testGetTextFromRow() {
24 $this->hideDeprecated( PageArchive
::class . '::getTextFromRow' );
26 /** @var SqlBlobStore $blobStore */
27 $blobStore = MediaWikiServices
::getInstance()->getBlobStore();
29 $textId = $blobStore->getTextIdFromAddress(
30 $this->firstRev
->getSlot( 'main' )->getAddress()
33 $row = (object)[ 'ar_text_id' => $textId ];
34 $text = $this->archivedPage
->getTextFromRow( $row );
35 $this->assertSame( 'testing', $text );
38 protected function getExpectedArchiveRows() {
39 /** @var SqlBlobStore $blobStore */
40 $blobStore = MediaWikiServices
::getInstance()->getBlobStore();
44 'ar_minor_edit' => '0',
46 'ar_user_text' => $this->ipEditor
,
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' => null,
57 'ar_content_format' => null,
58 'ar_content_model' => null,
61 'ar_namespace' => '0',
62 'ar_title' => 'PageArchiveTest_thePage',
63 'ar_text_id' => (string)$blobStore->getTextIdFromAddress(
64 $this->ipRev
->getSlot( 'main' )->getAddress()
66 'ar_parent_id' => strval( $this->ipRev
->getParentId() ),
69 'ar_minor_edit' => '0',
70 'ar_user' => (string)$this->getTestUser()->getUser()->getId(),
71 'ar_user_text' => $this->getTestUser()->getUser()->getName(),
75 'ar_rev_id' => strval( $this->firstRev
->getId() ),
76 'ar_timestamp' => $this->db
->timestamp( $this->firstRev
->getTimestamp() ),
77 'ar_sha1' => 'pr0s8e18148pxhgjfa0gjrvpy8fiyxc',
78 'ar_page_id' => strval( $this->firstRev
->getPageId() ),
79 'ar_comment_text' => 'testing',
80 'ar_comment_data' => null,
81 'ar_comment_cid' => null,
82 'ar_content_format' => null,
83 'ar_content_model' => null,
86 'ar_namespace' => '0',
87 'ar_title' => 'PageArchiveTest_thePage',
88 'ar_text_id' => (string)$blobStore->getTextIdFromAddress(
89 $this->firstRev
->getSlot( 'main' )->getAddress()
91 'ar_parent_id' => '0',