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