4 * @covers UnsupportedSlotDiffRenderer
6 class UnsupportedSlotDiffRendererTest
extends MediaWikiTestCase
{
8 public function provideDiff() {
9 $oldContent = new TextContent( 'Kittens' );
10 $newContent = new TextContent( 'Goats' );
11 $badContent = new UnknownContent( 'Dragons', 'xyzzy' );
13 yield
[ '(unsupported-content-diff)', $oldContent, null ];
14 yield
[ '(unsupported-content-diff)', null, $newContent ];
15 yield
[ '(unsupported-content-diff)', $oldContent, $newContent ];
16 yield
[ '(unsupported-content-diff2)', $badContent, $newContent ];
17 yield
[ '(unsupported-content-diff2)', $oldContent, $badContent ];
18 yield
[ '(unsupported-content-diff)', null, $badContent ];
19 yield
[ '(unsupported-content-diff)', $badContent, null ];
23 * @dataProvider provideDiff
25 public function testDiff( $expected, $oldContent, $newContent ) {
26 $this->mergeMwGlobalArrayValue(
28 [ 'xyzzy' => 'UnknownContentHandler' ]
31 $localizer = $this->getMock( MessageLocalizer
::class );
33 $localizer->method( 'msg' )
34 ->willReturnCallback( function ( $key, ...$params ) {
35 return new RawMessage( "($key)", $params );
38 $sdr = new UnsupportedSlotDiffRenderer( $localizer );
39 $this->assertContains( $expected, $sdr->getDiff( $oldContent, $newContent ) );