This causes RevisionStore to use FallbackContent instances to represent content for which no content handler is defined. This may happen when loading revisions using a model that was defined by an extension that has since been uninstalled. Bug: T220594 Bug: T220793 Bug: T228921 Change-Id: I5cc9e61223ab22406091479617b077512aa6ae2d
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @covers UnsupportedSlotDiffRenderer
|
|
*/
|
|
class UnsupportedSlotDiffRendererTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function provideDiff() {
|
|
$oldContent = new TextContent( 'Kittens' );
|
|
$newContent = new TextContent( 'Goats' );
|
|
$badContent = new FallbackContent( 'Dragons', 'xyzzy' );
|
|
|
|
yield [ '(unsupported-content-diff)', $oldContent, null ];
|
|
yield [ '(unsupported-content-diff)', null, $newContent ];
|
|
yield [ '(unsupported-content-diff)', $oldContent, $newContent ];
|
|
yield [ '(unsupported-content-diff2)', $badContent, $newContent ];
|
|
yield [ '(unsupported-content-diff2)', $oldContent, $badContent ];
|
|
yield [ '(unsupported-content-diff)', null, $badContent ];
|
|
yield [ '(unsupported-content-diff)', $badContent, null ];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideDiff
|
|
*/
|
|
public function testDiff( $expected, $oldContent, $newContent ) {
|
|
$this->mergeMwGlobalArrayValue(
|
|
'wgContentHandlers',
|
|
[ 'xyzzy' => 'UnknownContentHandler' ]
|
|
);
|
|
|
|
$localizer = $this->createMock( MessageLocalizer::class );
|
|
|
|
$localizer->method( 'msg' )
|
|
->willReturnCallback( function ( $key, ...$params ) {
|
|
return new RawMessage( "($key)", $params );
|
|
} );
|
|
|
|
$sdr = new UnsupportedSlotDiffRenderer( $localizer );
|
|
$this->assertStringContainsString( $expected, $sdr->getDiff( $oldContent, $newContent ) );
|
|
}
|
|
|
|
}
|