Merge "Fix unexpected return type of User::idFromName()"
[lhc/web/wiklou.git] / tests / phpunit / includes / page / WikiPageMcrReadNewDbTest.php
1 <?php
2
3 use MediaWiki\MediaWikiServices;
4 use MediaWiki\Tests\Revision\McrReadNewSchemaOverride;
5
6 /**
7 * Tests WikiPage against the intermediate MCR DB schema for use during schema migration.
8 *
9 * @covers WikiPage
10 *
11 * @group WikiPage
12 * @group Storage
13 * @group ContentHandler
14 * @group Database
15 * @group medium
16 */
17 class WikiPageMcrReadNewDbTest extends WikiPageDbTestBase {
18
19 use McrReadNewSchemaOverride;
20
21 protected function getContentHandlerUseDB() {
22 return true;
23 }
24
25 public function testGetDeletionUpdates() {
26 $m1 = $this->defineMockContentModelForUpdateTesting( 'M1' );
27 $a1 = $this->defineMockContentModelForUpdateTesting( 'A1' );
28
29 MediaWikiServices::getInstance()->getSlotRoleRegistry()->defineRoleWithModel(
30 'aux',
31 $a1->getModelID()
32 );
33
34 $mainContent1 = $this->createMockContent( $m1, 'main 1' );
35 $auxContent1 = $this->createMockContent( $a1, 'aux 1' );
36
37 $page = new WikiPage( Title::newFromText( __METHOD__ ) );
38 $page = $this->createPage(
39 $page,
40 [ 'main' => $mainContent1, 'aux' => $auxContent1 ]
41 );
42
43 $dataUpdates = $page->getDeletionUpdates( $page->getRevisionRecord() );
44 $this->assertNotEmpty( $dataUpdates );
45
46 $updateNames = array_map( function ( $du ) {
47 return isset( $du->_name ) ? $du->_name : get_class( $du );
48 }, $dataUpdates );
49
50 $this->assertContains( LinksDeletionUpdate::class, $updateNames );
51 $this->assertContains( 'M1 deletion update', $updateNames );
52 $this->assertContains( 'A1 deletion update', $updateNames );
53 }
54
55 }