wiki.techinc.nl/tests/phpunit/includes/diff/UnsupportedSlotDiffRendererTest.php
addshore 959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00

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 UnknownContent( '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 ) );
}
}