From cac44883d37b7a6651c8e28662c019a8f61f476b Mon Sep 17 00:00:00 2001 From: "physikerwelt (Moritz Schubotz)" Date: Sat, 28 Jun 2014 00:20:09 +0200 Subject: [PATCH] Fix MathDatabaseTest The test used an unnecessary call to setupTestDB. This might have caused that the unittest_math table was deleted twice during the setup routine of the unittest. Bug: 67148 Change-Id: I4a414900c1c2d97b759ef1755e53e82c5c2e8e14 --- tests/MathDatabaseTest.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/MathDatabaseTest.php b/tests/MathDatabaseTest.php index be913af..fcd946c 100644 --- a/tests/MathDatabaseTest.php +++ b/tests/MathDatabaseTest.php @@ -1,10 +1,11 @@ tablesUsed[] = 'math'; + * $this->tablesUsed[] = 'math'; * } * was not sufficient. */ @@ -33,8 +34,8 @@ class MathDatabaseTest extends MediaWikiTestCase { // Create a new instance of MathSource $this->renderer = new MathTexvc( self::SOME_TEX ); $this->tablesUsed[] = 'math'; - self::setupTestDB( $this->db, "mathtest" ); -} + } + /** * Checks the tex and hash functions * @covers MathRenderer::getInputHash() @@ -52,8 +53,9 @@ class MathDatabaseTest extends MediaWikiTestCase { $this->renderer->setTex( self::SOME_TEX ); $this->renderer->setMathml( self::SOME_MATHML ); $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. * @covers MathRenderer::writeDatabaseEntry() @@ -71,7 +73,6 @@ class MathDatabaseTest extends MediaWikiTestCase { } - /** * Checks the creation of the math table without debugging enabled. * @covers MathHooks::onLoadExtensionSchemaUpdates @@ -86,7 +87,7 @@ class MathDatabaseTest extends MediaWikiTestCase { $this->renderer->writeToDatabase(); $res = $this->db->select( "math", "*" ); $row = $res->fetchRow(); - $this->assertEquals( 10, sizeof( $row ) ); + $this->assertEquals( 10, sizeof( $row ) ); } /* @@ -100,8 +101,8 @@ class MathDatabaseTest extends MediaWikiTestCase { $this->assertTrue( $this->renderer->writeCache(), "Write new entry" ); $res = $this->db->selectField( "math", "math_inputhash", array( "math_inputhash" => $inputHash ) ); - $this->assertTrue( $res !== false , "Check database entry"); - $this->assertTrue( $this->renderer->readFromDatabase() , "Read entry from database"); + $this->assertTrue( $res !== false, "Check database entry" ); + $this->assertTrue( $this->renderer->readFromDatabase(), "Read entry from database" ); $this->assertFalse( $this->renderer->isChanged() ); // modify the database entry manually $this->db->delete( "math", array( "math_inputhash" => $inputHash ) );