wiki.techinc.nl/tests/phpunit/includes/page/WikiPageMcrReadNewDbTest.php
daniel 7960d5385f Introduce ContentHandler::getSecondaryDataUpdates.
This adds getSecondaryDataUpdates and getDeletionUpdates
to ContentHandler, and updates WikiPage and DerivedPageDataUpdates
to handle DataUpdates from all slots.

Bug: T194038
Bug: T194037
Change-Id: I75c96318f58a5cdda48484f7040ae41e6f42392a
2018-09-14 16:18:18 +02:00

48 lines
1.3 KiB
PHP

<?php
use MediaWiki\Tests\Storage\McrReadNewSchemaOverride;
/**
* Tests WikiPage against the intermediate MCR DB schema for use during schema migration.
*
* @covers WikiPage
*
* @group WikiPage
* @group Storage
* @group ContentHandler
* @group Database
* @group medium
*/
class WikiPageMcrReadNewDbTest extends WikiPageDbTestBase {
use McrReadNewSchemaOverride;
protected function getContentHandlerUseDB() {
return true;
}
public function testGetDeletionUpdates() {
$m1 = $this->defineMockContentModelForUpdateTesting( 'M1' );
$a1 = $this->defineMockContentModelForUpdateTesting( 'A1' );
$mainContent1 = $this->createMockContent( $m1, 'main 1' );
$auxContent1 = $this->createMockContent( $a1, 'aux 1' );
$page = new WikiPage( Title::newFromText( __METHOD__ ) );
$page = $this->createPage(
$page,
[ 'main' => $mainContent1, 'aux' => $auxContent1 ]
);
$dataUpdates = $page->getDeletionUpdates( $page->getRevisionRecord() );
$this->assertNotEmpty( $dataUpdates );
$updateNames = array_map( function ( $du ) {
return isset( $du->_name ) ? $du->_name : get_class( $du );
}, $dataUpdates );
$this->assertContains( LinksDeletionUpdate::class, $updateNames );
$this->assertContains( 'M1 deletion update', $updateNames );
$this->assertContains( 'A1 deletion update', $updateNames );
}
}