From: daniel Date: Wed, 5 Dec 2012 16:13:21 +0000 (+0100) Subject: While testing, turn off DataBase::ignoreErrors. X-Git-Tag: 1.31.0-rc.0~21413^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=abf22b914af1928b598e06553ea486bb511f5feb;p=lhc%2Fweb%2Fwiklou.git While testing, turn off DataBase::ignoreErrors. Database errors should cause an exception, not return false, unless the test case, or the code under test, explicitely calls ignoreErrors(true). The DB object should be reset to fail fast and safe for every test. Change-Id: Ifc2a720ec46a1843d9ffb1488c54743a0099ef9d --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index a594202106..908c076ab7 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -171,11 +171,14 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } } - // Clean up open transactions if ( $this->needsDB() && $this->db ) { + // Clean up open transactions while( $this->db->trxLevel() > 0 ) { $this->db->rollback(); } + + // don't ignore DB errors + $this->db->ignoreErrors( false ); } wfProfileOut( __METHOD__ ); @@ -193,11 +196,14 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } } - // Clean up open transactions if ( $this->needsDB() && $this->db ) { + // Clean up open transactions while( $this->db->trxLevel() > 0 ) { $this->db->rollback(); } + + // don't ignore DB errors + $this->db->ignoreErrors( false ); } // Restore mw globals