WikiPageMcrReadNewDbTest.php 1.3 KB

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