Improve tests coverage for MathPng

Change-Id: Ibb5138512afd20304983be44e0ab45a244634b4b
This commit is contained in:
Moritz Schubotz (physikerwelt) 2018-05-21 12:38:10 +02:00 committed by Thiemo Kreuz (WMDE)
parent 9b2ba59ac9
commit e359eafe6c
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
/**
* @covers MathPng
*
* @license GPL-2.0-or-later
*/
class MathPngTest extends MediaWikiTestCase {
/** @var string The fallback image HTML tag */
const TEST_DUMMY = '<img src="test.png" />';
public function testConstructor() {
$renderer = new MathPng( 'a' );
$this->assertEquals( 'png', $renderer->getMode() );
}
public function testOutput() {
$renderer = $this->getMockBuilder( MathPng::class )
->setMethods( [ 'getFallbackImage' ] )
->getMock();
$renderer->method( 'getFallbackImage' )
->willReturn( self::TEST_DUMMY );
$this->assertSame( self::TEST_DUMMY, $renderer->getHtmlOutput() );
}
}