2 namespace MediaWiki\Tests\Revision
;
4 use InvalidArgumentException
;
5 use MediaWiki\Revision\RevisionRecord
;
10 * Tests RevisionStore against the pre-MCR DB schema.
12 * @covers \MediaWiki\Revision\RevisionStore
14 * @group RevisionStore
19 class PreMcrRevisionStoreDbTest
extends RevisionStoreDbTestBase
{
21 use PreMcrSchemaOverride
;
23 protected function revisionToRow( Revision
$rev, $options = [ 'page', 'user', 'comment' ] ) {
24 $row = parent
::revisionToRow( $rev, $options );
26 $row->rev_text_id
= (string)$rev->getTextId();
27 $row->rev_content_format
= (string)$rev->getContentFormat();
28 $row->rev_content_model
= (string)$rev->getContentModel();
33 protected function assertRevisionExistsInDatabase( RevisionRecord
$rev ) {
34 // Legacy schema is still being written
36 [ 'revision', 'text' ],
38 [ 'rev_id' => $rev->getId(), 'rev_text_id > 0' ],
41 [ 'text' => [ 'JOIN', [ 'rev_text_id = old_id' ] ] ]
44 parent
::assertRevisionExistsInDatabase( $rev );
47 public function provideInsertRevisionOn_failures() {
48 foreach ( parent
::provideInsertRevisionOn_failures() as $case ) {
52 yield
'slot that is not main slot' => [
55 'main' => new WikitextContent( 'Chicken' ),
56 'lalala' => new WikitextContent( 'Duck' ),
58 'comment' => $this->getRandomCommentStoreComment(),
59 'timestamp' => '20171117010101',
62 new InvalidArgumentException( 'Only the main slot is supported' )
66 public function provideNewMutableRevisionFromArray() {
67 foreach ( parent
::provideNewMutableRevisionFromArray() as $case ) {
71 yield
'Basic array, with page & id' => [
76 'timestamp' => '20171017114835',
77 'user_text' => '111.0.1.2',
79 'minor_edit' => false,
83 'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
84 'comment' => 'Goat Comment!',
85 'content_format' => 'text/x-wiki',
86 'content_model' => 'wikitext',