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