MediaWiki REL1_33
PageArchiveMcrTest.php
Go to the documentation of this file.
1<?php
3use MediaWiki\Tests\Revision\McrSchemaOverride;
4
16
17 use McrSchemaOverride;
18
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}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getTestUser( $groups=[])
Convenience method for getting an immutable test user.
assertSelect( $table, $fields, $condition, array $expectedRows, array $options=[], array $join_conds=[])
Asserts that the given database query yields the rows given by $expectedRows.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Test class for page archiving, using the new MCR schema.
testListRevisions_slots()
PageArchive::listRevisions.
Base class for tests of PageArchive against different database schemas.
$ipEditor
A logged out user who edited the page before it was archived.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:585
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37