Merge "Fix MathDatabaseTest"
This commit is contained in:
commit
4eebc40812
|
@ -1,10 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the database access and core functionality of MathRenderer.
|
* Test the database access and core functionality of MathRenderer.
|
||||||
*
|
*
|
||||||
* @group Math
|
* @group Math
|
||||||
* @group Database //Used by needsDB
|
* @group Database //Used by needsDB
|
||||||
*/
|
*/
|
||||||
class MathDatabaseTest extends MediaWikiTestCase {
|
class MathDatabaseTest extends MediaWikiTestCase {
|
||||||
/**
|
/**
|
||||||
* @var MathRenderer
|
* @var MathRenderer
|
||||||
|
@ -33,8 +34,8 @@ class MathDatabaseTest extends MediaWikiTestCase {
|
||||||
// Create a new instance of MathSource
|
// Create a new instance of MathSource
|
||||||
$this->renderer = new MathTexvc( self::SOME_TEX );
|
$this->renderer = new MathTexvc( self::SOME_TEX );
|
||||||
$this->tablesUsed[] = 'math';
|
$this->tablesUsed[] = 'math';
|
||||||
self::setupTestDB( $this->db, "mathtest" );
|
}
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Checks the tex and hash functions
|
* Checks the tex and hash functions
|
||||||
* @covers MathRenderer::getInputHash()
|
* @covers MathRenderer::getInputHash()
|
||||||
|
@ -52,8 +53,9 @@ class MathDatabaseTest extends MediaWikiTestCase {
|
||||||
$this->renderer->setTex( self::SOME_TEX );
|
$this->renderer->setTex( self::SOME_TEX );
|
||||||
$this->renderer->setMathml( self::SOME_MATHML );
|
$this->renderer->setMathml( self::SOME_MATHML );
|
||||||
$this->renderer->setHtml( self::SOME_HTML );
|
$this->renderer->setHtml( self::SOME_HTML );
|
||||||
$this->renderer->setOutputHash( self::SOME_OUTPUTHASH);
|
$this->renderer->setOutputHash( self::SOME_OUTPUTHASH );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks database access. Writes an entry and reads it back.
|
* Checks database access. Writes an entry and reads it back.
|
||||||
* @covers MathRenderer::writeDatabaseEntry()
|
* @covers MathRenderer::writeDatabaseEntry()
|
||||||
|
@ -71,7 +73,6 @@ class MathDatabaseTest extends MediaWikiTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the creation of the math table without debugging enabled.
|
* Checks the creation of the math table without debugging enabled.
|
||||||
* @covers MathHooks::onLoadExtensionSchemaUpdates
|
* @covers MathHooks::onLoadExtensionSchemaUpdates
|
||||||
|
@ -100,8 +101,8 @@ class MathDatabaseTest extends MediaWikiTestCase {
|
||||||
$this->assertTrue( $this->renderer->writeCache(), "Write new entry" );
|
$this->assertTrue( $this->renderer->writeCache(), "Write new entry" );
|
||||||
$res = $this->db->selectField( "math", "math_inputhash",
|
$res = $this->db->selectField( "math", "math_inputhash",
|
||||||
array( "math_inputhash" => $inputHash ) );
|
array( "math_inputhash" => $inputHash ) );
|
||||||
$this->assertTrue( $res !== false , "Check database entry");
|
$this->assertTrue( $res !== false, "Check database entry" );
|
||||||
$this->assertTrue( $this->renderer->readFromDatabase() , "Read entry from database");
|
$this->assertTrue( $this->renderer->readFromDatabase(), "Read entry from database" );
|
||||||
$this->assertFalse( $this->renderer->isChanged() );
|
$this->assertFalse( $this->renderer->isChanged() );
|
||||||
// modify the database entry manually
|
// modify the database entry manually
|
||||||
$this->db->delete( "math", array( "math_inputhash" => $inputHash ) );
|
$this->db->delete( "math", array( "math_inputhash" => $inputHash ) );
|
||||||
|
|
Loading…
Reference in New Issue