mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-29 09:54:58 +00:00
10662ea6e3
Rename according to base class that we test. Change-Id: I8b8969fa3f6b8b5d78ac9b5308db2ba2b4181226
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Test the database access and core functionallity of MathRenderer.
|
|
*
|
|
* @group Math
|
|
*/
|
|
class MathRendererTest extends MediaWikiTestCase {
|
|
/**
|
|
* Checks the tex and hash functions
|
|
* @covers MathRenderer::getTex()
|
|
* @covers MathRenderer::__construct()
|
|
*/
|
|
public function testBasics() {
|
|
$renderer = $this->getMockForAbstractClass( 'MathRenderer', array ( MathDatabaseTest::SOME_TEX ) );
|
|
// check if the TeX input was corretly passed to the class
|
|
$this->assertEquals( MathDatabaseTest::SOME_TEX, $renderer->getTex(), "test getTex" );
|
|
}
|
|
|
|
/**
|
|
* Test behavior of writeCache() when nothing was changed
|
|
* @covers MathRenderer::writeCache()
|
|
*/
|
|
public function testWriteCacheSkip() {
|
|
$renderer = $this->getMockBuilder( 'MathRenderer' )
|
|
->setMethods( array( 'writeDBEntry' , 'render' ) )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$renderer->expects( $this->never() )
|
|
->method( 'writeDBEntry' );
|
|
$renderer->writeCache();
|
|
}
|
|
|
|
/**
|
|
* Test behavior of writeCache() when values were changed.
|
|
* @covers MathRenderer::writeCache()
|
|
*/
|
|
public function testWriteCache() {
|
|
$renderer = $this->getMockBuilder( 'MathRenderer' )
|
|
->setMethods( array( 'writeDBEntry' , 'render' ) )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$renderer->expects( $this->never() )
|
|
->method( 'writeDBEntry' );
|
|
$renderer->writeCache();
|
|
}
|
|
} |