Merge "OOUI: Bring forward UBN fix for DropdownInputWidget with MenuSectionOptionWidget"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backup_PageTest.php
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use DumpBackup;
6 use Exception;
7 use MediaWiki\MediaWikiServices;
8 use MediaWikiTestCase;
9 use MWException;
10 use Title;
11 use WikiExporter;
12 use Wikimedia\Rdbms\IDatabase;
13 use Wikimedia\Rdbms\LoadBalancer;
14 use WikiPage;
15
16 /**
17 * Tests for page dumps of BackupDumper
18 *
19 * @group Database
20 * @group Dump
21 * @covers BackupDumper
22 */
23 class BackupDumperPageTest extends DumpTestCase {
24
25 // We'll add several pages, revision and texts. The following variables hold the
26 // corresponding ids.
27 private $pageId1, $pageId2, $pageId3, $pageId4;
28 private $pageTitle1, $pageTitle2, $pageTitle3, $pageTitle4;
29 private $revId1_1, $textId1_1;
30 private $revId2_1, $textId2_1, $revId2_2, $textId2_2;
31 private $revId2_3, $textId2_3, $revId2_4, $textId2_4;
32 private $revId3_1, $textId3_1, $revId3_2, $textId3_2;
33 private $revId4_1, $textId4_1;
34 private $namespace, $talk_namespace;
35
36 /**
37 * @var LoadBalancer|null
38 */
39 private $streamingLoadBalancer = null;
40
41 function addDBData() {
42 // be sure, titles created here using english namespace names
43 $this->setContentLang( 'en' );
44
45 $this->tablesUsed[] = 'page';
46 $this->tablesUsed[] = 'revision';
47 $this->tablesUsed[] = 'ip_changes';
48 $this->tablesUsed[] = 'text';
49
50 try {
51 $this->namespace = $this->getDefaultWikitextNS();
52 $this->talk_namespace = NS_TALK;
53
54 if ( $this->namespace === $this->talk_namespace ) {
55 // @todo work around this.
56 throw new MWException( "The default wikitext namespace is the talk namespace. "
57 . " We can't currently deal with that." );
58 }
59
60 $this->pageTitle1 = Title::newFromText( 'BackupDumperTestP1', $this->namespace );
61 $page = WikiPage::factory( $this->pageTitle1 );
62 list( $this->revId1_1, $this->textId1_1 ) = $this->addRevision( $page,
63 "BackupDumperTestP1Text1", "BackupDumperTestP1Summary1" );
64 $this->pageId1 = $page->getId();
65
66 $this->pageTitle2 = Title::newFromText( 'BackupDumperTestP2', $this->namespace );
67 $page = WikiPage::factory( $this->pageTitle2 );
68 list( $this->revId2_1, $this->textId2_1 ) = $this->addRevision( $page,
69 "BackupDumperTestP2Text1", "BackupDumperTestP2Summary1" );
70 list( $this->revId2_2, $this->textId2_2 ) = $this->addRevision( $page,
71 "BackupDumperTestP2Text2", "BackupDumperTestP2Summary2" );
72 list( $this->revId2_3, $this->textId2_3 ) = $this->addRevision( $page,
73 "BackupDumperTestP2Text3", "BackupDumperTestP2Summary3" );
74 list( $this->revId2_4, $this->textId2_4 ) = $this->addRevision( $page,
75 "BackupDumperTestP2Text4 some additional Text ",
76 "BackupDumperTestP2Summary4 extra " );
77 $this->pageId2 = $page->getId();
78
79 $this->pageTitle3 = Title::newFromText( 'BackupDumperTestP3', $this->namespace );
80 $page = WikiPage::factory( $this->pageTitle3 );
81 list( $this->revId3_1, $this->textId3_1 ) = $this->addRevision( $page,
82 "BackupDumperTestP3Text1", "BackupDumperTestP2Summary1" );
83 list( $this->revId3_2, $this->textId3_2 ) = $this->addRevision( $page,
84 "BackupDumperTestP3Text2", "BackupDumperTestP2Summary2" );
85 $this->pageId3 = $page->getId();
86 $page->doDeleteArticle( "Testing ;)" );
87
88 $this->pageTitle4 = Title::newFromText( 'BackupDumperTestP1', $this->talk_namespace );
89 $page = WikiPage::factory( $this->pageTitle4 );
90 list( $this->revId4_1, $this->textId4_1 ) = $this->addRevision( $page,
91 "Talk about BackupDumperTestP1 Text1",
92 "Talk BackupDumperTestP1 Summary1" );
93 $this->pageId4 = $page->getId();
94 } catch ( Exception $e ) {
95 // We'd love to pass $e directly. However, ... see
96 // documentation of exceptionFromAddDBData in
97 // DumpTestCase
98 $this->exceptionFromAddDBData = $e;
99 }
100 }
101
102 protected function setUp() {
103 parent::setUp();
104
105 // Since we will restrict dumping by page ranges (to allow
106 // working tests, even if the db gets prepopulated by a base
107 // class), we have to assert, that the page id are consecutively
108 // increasing
109 $this->assertEquals(
110 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
111 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
112 "Page ids increasing without holes" );
113 }
114
115 function tearDown() {
116 parent::tearDown();
117
118 if ( isset( $this->streamingLoadBalancer ) ) {
119 $this->streamingLoadBalancer->closeAll();
120 }
121 }
122
123 /**
124 * Returns a new database connection which is separate from the conenctions returned
125 * by the default LoadBalancer instance.
126 *
127 * @return IDatabase
128 */
129 private function newStreamingDBConnection() {
130 // Create a *new* LoadBalancer, so no connections are shared
131 if ( !$this->streamingLoadBalancer ) {
132 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
133
134 $this->streamingLoadBalancer = $lbFactory->newMainLB();
135 }
136
137 $db = $this->streamingLoadBalancer->getConnection( DB_REPLICA );
138
139 // Make sure the DB connection has the fake table clones and the fake table prefix
140 MediaWikiTestCase::setupDatabaseWithTestPrefix( $db );
141
142 // Make sure the DB connection has all the test data
143 $this->copyTestData( $this->db, $db );
144
145 return $db;
146 }
147
148 /**
149 * @param array $argv
150 * @param int $startId
151 * @param int $endId
152 *
153 * @return DumpBackup
154 */
155 private function newDumpBackup( $argv, $startId, $endId ) {
156 $dumper = new DumpBackup( $argv );
157 $dumper->startId = $startId;
158 $dumper->endId = $endId;
159 $dumper->reporting = false;
160
161 // NOTE: The copyTestData() method used by newStreamingDBConnection()
162 // doesn't work with SQLite (T217607).
163 // But DatabaseSqlite doesn't support streaming anyway, so just skip that part.
164 if ( $this->db->getType() === 'sqlite' ) {
165 $dumper->setDB( $this->db );
166 } else {
167 $dumper->setDB( $this->newStreamingDBConnection() );
168 }
169
170 return $dumper;
171 }
172
173 public function schemaVersionProvider() {
174 yield [ '0.10' ];
175 }
176
177 /**
178 * @dataProvider schemaVersionProvider
179 */
180 function testFullTextPlain( $schemaVersion ) {
181 // Preparing the dump
182 $fname = $this->getNewTempFile();
183
184 $dumper = $this->newDumpBackup(
185 [ '--full', '--quiet', '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
186 $this->pageId1,
187 $this->pageId4 + 1
188 );
189
190 // Performing the dump
191 $dumper->execute();
192
193 // Checking the dumped data
194 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
195 $asserter = $this->getDumpAsserter( $schemaVersion );
196
197 $asserter->assertDumpStart( $fname );
198
199 // Page 1
200 $asserter->assertPageStart(
201 $this->pageId1,
202 $this->namespace,
203 $this->pageTitle1->getPrefixedText()
204 );
205 $asserter->assertRevision(
206 $this->revId1_1,
207 "BackupDumperTestP1Summary1",
208 $this->textId1_1,
209 23,
210 "0bolhl6ol7i6x0e7yq91gxgaan39j87",
211 "BackupDumperTestP1Text1"
212 );
213 $asserter->assertPageEnd();
214
215 // Page 2
216 $asserter->assertPageStart(
217 $this->pageId2,
218 $this->namespace,
219 $this->pageTitle2->getPrefixedText()
220 );
221 $asserter->assertRevision(
222 $this->revId2_1,
223 "BackupDumperTestP2Summary1",
224 $this->textId2_1,
225 23,
226 "jprywrymfhysqllua29tj3sc7z39dl2",
227 "BackupDumperTestP2Text1"
228 );
229 $asserter->assertRevision(
230 $this->revId2_2,
231 "BackupDumperTestP2Summary2",
232 $this->textId2_2,
233 23,
234 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
235 "BackupDumperTestP2Text2",
236 $this->revId2_1
237 );
238 $asserter->assertRevision(
239 $this->revId2_3,
240 "BackupDumperTestP2Summary3",
241 $this->textId2_3,
242 23,
243 "jfunqmh1ssfb8rs43r19w98k28gg56r",
244 "BackupDumperTestP2Text3",
245 $this->revId2_2
246 );
247 $asserter->assertRevision(
248 $this->revId2_4,
249 "BackupDumperTestP2Summary4 extra",
250 $this->textId2_4,
251 44,
252 "6o1ciaxa6pybnqprmungwofc4lv00wv",
253 "BackupDumperTestP2Text4 some additional Text",
254 $this->revId2_3
255 );
256 $asserter->assertPageEnd();
257
258 // Page 3
259 // -> Page is marked deleted. Hence not visible
260
261 // Page 4
262 $asserter->assertPageStart(
263 $this->pageId4,
264 $this->talk_namespace,
265 $this->pageTitle4->getPrefixedText()
266 );
267 $asserter->assertRevision(
268 $this->revId4_1,
269 "Talk BackupDumperTestP1 Summary1",
270 $this->textId4_1,
271 35,
272 "nktofwzd0tl192k3zfepmlzxoax1lpe",
273 "Talk about BackupDumperTestP1 Text1",
274 false,
275 CONTENT_MODEL_WIKITEXT,
276 CONTENT_FORMAT_WIKITEXT,
277 $schemaVersion
278 );
279 $asserter->assertPageEnd();
280
281 $asserter->assertDumpEnd();
282
283 // FIXME: add multi-slot test case!
284 }
285
286 /**
287 * @dataProvider schemaVersionProvider
288 */
289 function testFullStubPlain( $schemaVersion ) {
290 // Preparing the dump
291 $fname = $this->getNewTempFile();
292
293 $dumper = $this->newDumpBackup(
294 [
295 '--full',
296 '--quiet',
297 '--output',
298 'file:' . $fname,
299 '--stub',
300 '--schema-version', $schemaVersion,
301 ],
302 $this->pageId1,
303 $this->pageId4 + 1
304 );
305
306 // Performing the dump
307 $dumper->execute();
308
309 // Checking the dumped data
310 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
311 $asserter = $this->getDumpAsserter( $schemaVersion );
312
313 $asserter->assertDumpStart( $fname );
314
315 // Page 1
316 $asserter->assertPageStart(
317 $this->pageId1,
318 $this->namespace,
319 $this->pageTitle1->getPrefixedText()
320 );
321 $asserter->assertRevision(
322 $this->revId1_1,
323 "BackupDumperTestP1Summary1",
324 $this->textId1_1,
325 23,
326 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
327 );
328 $asserter->assertPageEnd();
329
330 // Page 2
331 $asserter->assertPageStart(
332 $this->pageId2,
333 $this->namespace,
334 $this->pageTitle2->getPrefixedText()
335 );
336 $asserter->assertRevision(
337 $this->revId2_1,
338 "BackupDumperTestP2Summary1",
339 $this->textId2_1,
340 23,
341 "jprywrymfhysqllua29tj3sc7z39dl2"
342 );
343 $asserter->assertRevision(
344 $this->revId2_2,
345 "BackupDumperTestP2Summary2",
346 $this->textId2_2,
347 23,
348 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
349 false,
350 $this->revId2_1
351 );
352 $asserter->assertRevision(
353 $this->revId2_3,
354 "BackupDumperTestP2Summary3",
355 $this->textId2_3,
356 23,
357 "jfunqmh1ssfb8rs43r19w98k28gg56r",
358 false,
359 $this->revId2_2
360 );
361 $asserter->assertRevision(
362 $this->revId2_4,
363 "BackupDumperTestP2Summary4 extra",
364 $this->textId2_4,
365 44,
366 "6o1ciaxa6pybnqprmungwofc4lv00wv",
367 false,
368 $this->revId2_3
369 );
370 $asserter->assertPageEnd();
371
372 // Page 3
373 // -> Page is marked deleted. Hence not visible
374
375 // Page 4
376 $asserter->assertPageStart(
377 $this->pageId4,
378 $this->talk_namespace,
379 $this->pageTitle4->getPrefixedText()
380 );
381 $asserter->assertRevision(
382 $this->revId4_1,
383 "Talk BackupDumperTestP1 Summary1",
384 $this->textId4_1,
385 35,
386 "nktofwzd0tl192k3zfepmlzxoax1lpe"
387 );
388 $asserter->assertPageEnd();
389
390 $asserter->assertDumpEnd();
391 }
392
393 /**
394 * @dataProvider schemaVersionProvider
395 */
396 function testCurrentStubPlain( $schemaVersion ) {
397 // Preparing the dump
398 $fname = $this->getNewTempFile();
399
400 $dumper = $this->newDumpBackup(
401 [ '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
402 $this->pageId1,
403 $this->pageId4 + 1
404 );
405
406 // Performing the dump
407 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
408
409 // Checking the dumped data
410 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
411
412 $asserter = $this->getDumpAsserter( $schemaVersion );
413 $asserter->assertDumpStart( $fname );
414
415 // Page 1
416 $asserter->assertPageStart(
417 $this->pageId1,
418 $this->namespace,
419 $this->pageTitle1->getPrefixedText()
420 );
421 $asserter->assertRevision(
422 $this->revId1_1,
423 "BackupDumperTestP1Summary1",
424 $this->textId1_1,
425 23,
426 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
427 );
428 $asserter->assertPageEnd();
429
430 // Page 2
431 $asserter->assertPageStart(
432 $this->pageId2,
433 $this->namespace,
434 $this->pageTitle2->getPrefixedText()
435 );
436 $asserter->assertRevision(
437 $this->revId2_4,
438 "BackupDumperTestP2Summary4 extra",
439 $this->textId2_4,
440 44,
441 "6o1ciaxa6pybnqprmungwofc4lv00wv",
442 false,
443 $this->revId2_3
444 );
445 $asserter->assertPageEnd();
446
447 // Page 3
448 // -> Page is marked deleted. Hence not visible
449
450 // Page 4
451 $asserter->assertPageStart(
452 $this->pageId4,
453 $this->talk_namespace,
454 $this->pageTitle4->getPrefixedText()
455 );
456 $asserter->assertRevision(
457 $this->revId4_1,
458 "Talk BackupDumperTestP1 Summary1",
459 $this->textId4_1,
460 35,
461 "nktofwzd0tl192k3zfepmlzxoax1lpe"
462 );
463 $asserter->assertPageEnd();
464
465 $asserter->assertDumpEnd();
466 }
467
468 function testCurrentStubGzip() {
469 $this->checkHasGzip();
470
471 // Preparing the dump
472 $fname = $this->getNewTempFile();
473
474 $dumper = $this->newDumpBackup(
475 [ '--output', 'gzip:' . $fname ],
476 $this->pageId1,
477 $this->pageId4 + 1
478 );
479
480 // Performing the dump
481 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
482
483 // Checking the dumped data
484 $this->gunzip( $fname );
485
486 $asserter = $this->getDumpAsserter();
487 $asserter->assertDumpStart( $fname );
488
489 // Page 1
490 $asserter->assertPageStart(
491 $this->pageId1,
492 $this->namespace,
493 $this->pageTitle1->getPrefixedText()
494 );
495 $asserter->assertRevision(
496 $this->revId1_1,
497 "BackupDumperTestP1Summary1",
498 $this->textId1_1,
499 23,
500 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
501 );
502 $asserter->assertPageEnd();
503
504 // Page 2
505 $asserter->assertPageStart(
506 $this->pageId2,
507 $this->namespace,
508 $this->pageTitle2->getPrefixedText()
509 );
510 $asserter->assertRevision(
511 $this->revId2_4,
512 "BackupDumperTestP2Summary4 extra",
513 $this->textId2_4,
514 44,
515 "6o1ciaxa6pybnqprmungwofc4lv00wv",
516 false,
517 $this->revId2_3
518 );
519 $asserter->assertPageEnd();
520
521 // Page 3
522 // -> Page is marked deleted. Hence not visible
523
524 // Page 4
525 $asserter->assertPageStart(
526 $this->pageId4,
527 $this->talk_namespace,
528 $this->pageTitle4->getPrefixedText()
529 );
530 $asserter->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
531 $this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
532 $asserter->assertPageEnd();
533
534 $asserter->assertDumpEnd();
535 }
536
537 /**
538 * xmldumps-backup typically performs a single dump that that writes
539 * out three files
540 * - gzipped stubs of everything (meta-history)
541 * - gzipped stubs of latest revisions of all pages (meta-current)
542 * - gzipped stubs of latest revisions of all pages of namespage 0
543 * (articles)
544 *
545 * We reproduce such a setup with our mini fixture, although we omit
546 * chunks, and all the other gimmicks of xmldumps-backup.
547 *
548 * @dataProvider schemaVersionProvider
549 */
550 function testXmlDumpsBackupUseCase( $schemaVersion ) {
551 $this->checkHasGzip();
552
553 $fnameMetaHistory = $this->getNewTempFile();
554 $fnameMetaCurrent = $this->getNewTempFile();
555 $fnameArticles = $this->getNewTempFile();
556
557 $dumper = $this->newDumpBackup(
558 [ "--full", "--stub", "--output=gzip:" . $fnameMetaHistory,
559 "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
560 "--output=gzip:" . $fnameArticles, "--filter=latest",
561 "--filter=notalk", "--filter=namespace:!NS_USER",
562 "--reporting=1000", '--schema-version', $schemaVersion
563 ],
564 $this->pageId1,
565 $this->pageId4 + 1
566 );
567 $dumper->reporting = true;
568
569 // xmldumps-backup uses reporting. We will not check the exact reported
570 // message, as they are dependent on the processing power of the used
571 // computer. We only check that reporting does not crash the dumping
572 // and that something is reported
573 $dumper->stderr = fopen( 'php://output', 'a' );
574 if ( $dumper->stderr === false ) {
575 $this->fail( "Could not open stream for stderr" );
576 }
577
578 // Performing the dump
579 $dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
580
581 $this->assertTrue( fclose( $dumper->stderr ), "Closing stderr handle" );
582
583 // Checking meta-history -------------------------------------------------
584
585 $this->gunzip( $fnameMetaHistory );
586 $this->assertDumpSchema( $fnameMetaHistory, $this->getXmlSchemaPath( $schemaVersion ) );
587
588 $asserter = $this->getDumpAsserter( $schemaVersion );
589 $asserter->assertDumpStart( $fnameMetaHistory );
590
591 // Page 1
592 $asserter->assertPageStart(
593 $this->pageId1,
594 $this->namespace,
595 $this->pageTitle1->getPrefixedText()
596 );
597 $asserter->assertRevision(
598 $this->revId1_1,
599 "BackupDumperTestP1Summary1",
600 $this->textId1_1,
601 23,
602 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
603 );
604 $asserter->assertPageEnd();
605
606 // Page 2
607 $asserter->assertPageStart(
608 $this->pageId2,
609 $this->namespace,
610 $this->pageTitle2->getPrefixedText()
611 );
612 $asserter->assertRevision(
613 $this->revId2_1,
614 "BackupDumperTestP2Summary1",
615 $this->textId2_1,
616 23,
617 "jprywrymfhysqllua29tj3sc7z39dl2"
618 );
619 $asserter->assertRevision(
620 $this->revId2_2,
621 "BackupDumperTestP2Summary2",
622 $this->textId2_2,
623 23,
624 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
625 false,
626 $this->revId2_1
627 );
628 $asserter->assertRevision(
629 $this->revId2_3,
630 "BackupDumperTestP2Summary3",
631 $this->textId2_3,
632 23,
633 "jfunqmh1ssfb8rs43r19w98k28gg56r",
634 false,
635 $this->revId2_2
636 );
637 $asserter->assertRevision(
638 $this->revId2_4,
639 "BackupDumperTestP2Summary4 extra",
640 $this->textId2_4,
641 44,
642 "6o1ciaxa6pybnqprmungwofc4lv00wv",
643 false,
644 $this->revId2_3
645 );
646 $asserter->assertPageEnd();
647
648 // Page 3
649 // -> Page is marked deleted. Hence not visible
650
651 // Page 4
652 $asserter->assertPageStart(
653 $this->pageId4,
654 $this->talk_namespace,
655 $this->pageTitle4->getPrefixedText( $schemaVersion )
656 );
657 $asserter->assertRevision(
658 $this->revId4_1,
659 "Talk BackupDumperTestP1 Summary1",
660 $this->textId4_1,
661 35,
662 "nktofwzd0tl192k3zfepmlzxoax1lpe"
663 );
664 $asserter->assertPageEnd();
665
666 $asserter->assertDumpEnd();
667
668 // Checking meta-current -------------------------------------------------
669
670 $this->gunzip( $fnameMetaCurrent );
671 $this->assertDumpSchema( $fnameMetaCurrent, $this->getXmlSchemaPath( $schemaVersion ) );
672
673 $asserter = $this->getDumpAsserter( $schemaVersion );
674 $asserter->assertDumpStart( $fnameMetaCurrent );
675
676 // Page 1
677 $asserter->assertPageStart(
678 $this->pageId1,
679 $this->namespace,
680 $this->pageTitle1->getPrefixedText()
681 );
682 $asserter->assertRevision(
683 $this->revId1_1,
684 "BackupDumperTestP1Summary1",
685 $this->textId1_1,
686 23,
687 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
688 );
689 $asserter->assertPageEnd();
690
691 // Page 2
692 $asserter->assertPageStart(
693 $this->pageId2,
694 $this->namespace,
695 $this->pageTitle2->getPrefixedText()
696 );
697 $asserter->assertRevision(
698 $this->revId2_4,
699 "BackupDumperTestP2Summary4 extra",
700 $this->textId2_4,
701 44,
702 "6o1ciaxa6pybnqprmungwofc4lv00wv",
703 false,
704 $this->revId2_3
705 );
706 $asserter->assertPageEnd();
707
708 // Page 3
709 // -> Page is marked deleted. Hence not visible
710
711 // Page 4
712 $asserter->assertPageStart(
713 $this->pageId4,
714 $this->talk_namespace,
715 $this->pageTitle4->getPrefixedText()
716 );
717 $asserter->assertRevision(
718 $this->revId4_1,
719 "Talk BackupDumperTestP1 Summary1",
720 $this->textId4_1,
721 35,
722 "nktofwzd0tl192k3zfepmlzxoax1lpe"
723 );
724 $asserter->assertPageEnd();
725
726 $asserter->assertDumpEnd();
727
728 // Checking articles -------------------------------------------------
729
730 $this->gunzip( $fnameArticles );
731 $this->assertDumpSchema( $fnameArticles, $this->getXmlSchemaPath( $schemaVersion ) );
732
733 $asserter = $this->getDumpAsserter( $schemaVersion );
734 $asserter->assertDumpStart( $fnameArticles );
735
736 // Page 1
737 $asserter->assertPageStart(
738 $this->pageId1,
739 $this->namespace,
740 $this->pageTitle1->getPrefixedText()
741 );
742 $asserter->assertRevision(
743 $this->revId1_1,
744 "BackupDumperTestP1Summary1",
745 $this->textId1_1,
746 23,
747 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
748 );
749 $asserter->assertPageEnd();
750
751 // Page 2
752 $asserter->assertPageStart(
753 $this->pageId2,
754 $this->namespace,
755 $this->pageTitle2->getPrefixedText()
756 );
757 $asserter->assertRevision(
758 $this->revId2_4,
759 "BackupDumperTestP2Summary4 extra",
760 $this->textId2_4,
761 44,
762 "6o1ciaxa6pybnqprmungwofc4lv00wv",
763 false,
764 $this->revId2_3
765 );
766 $asserter->assertPageEnd();
767
768 // Page 3
769 // -> Page is marked deleted. Hence not visible
770
771 // Page 4
772 // -> Page is not in $this->namespace. Hence not visible
773
774 $asserter->assertDumpEnd();
775
776 $this->expectETAOutput();
777 }
778 }