PageArchiveMcrTest.php 2.4 KB

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