2018-05-21 10:38:10 +00:00
|
|
|
<?php
|
|
|
|
|
2021-08-11 18:15:35 +00:00
|
|
|
use MediaWiki\Extension\Math\MathConfig;
|
2021-04-07 22:22:05 +00:00
|
|
|
use MediaWiki\Extension\Math\MathPng;
|
|
|
|
|
2018-05-21 10:38:10 +00:00
|
|
|
/**
|
2021-04-07 22:22:05 +00:00
|
|
|
* @covers \MediaWiki\Extension\Math\MathPng
|
2018-05-21 10:38:10 +00:00
|
|
|
*
|
|
|
|
* @license GPL-2.0-or-later
|
|
|
|
*/
|
2021-10-11 22:51:10 +00:00
|
|
|
class MathPngTest extends MediaWikiIntegrationTestCase {
|
2018-05-21 10:38:10 +00:00
|
|
|
|
|
|
|
/** @var string The fallback image HTML tag */
|
2020-05-30 01:13:31 +00:00
|
|
|
private const TEST_DUMMY = '<img src="test.png" />';
|
2018-05-21 10:38:10 +00:00
|
|
|
|
|
|
|
public function testConstructor() {
|
|
|
|
$renderer = new MathPng( 'a' );
|
|
|
|
|
2021-08-11 18:15:35 +00:00
|
|
|
$this->assertEquals( MathConfig::MODE_PNG, $renderer->getMode() );
|
2018-05-21 10:38:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testOutput() {
|
|
|
|
$renderer = $this->getMockBuilder( MathPng::class )
|
2021-05-04 08:06:42 +00:00
|
|
|
->onlyMethods( [ 'getFallbackImage' ] )
|
2018-05-21 10:38:10 +00:00
|
|
|
->getMock();
|
|
|
|
$renderer->method( 'getFallbackImage' )
|
|
|
|
->willReturn( self::TEST_DUMMY );
|
|
|
|
|
|
|
|
$this->assertSame( self::TEST_DUMMY, $renderer->getHtmlOutput() );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|