aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/db/DatabaseSQLTest.php
diff options
context:
space:
mode:
authorTimo Tijhof <ttijhof@wikimedia.org>2012-10-08 12:56:20 +0200
committerTimo Tijhof <ttijhof@wikimedia.org>2012-10-09 03:01:51 +0200
commit181c7cdc8e9b019ff3c7cfa40452a7791be98dff (patch)
treee035101385b13a886c4ca9dcbde663c2fc59b4ba /tests/phpunit/includes/db/DatabaseSQLTest.php
parentd1c8bf85f86e3a535bcb1c484855631ae4930036 (diff)
downloadmediawikicore-181c7cdc8e9b019ff3c7cfa40452a7791be98dff.tar.gz
mediawikicore-181c7cdc8e9b019ff3c7cfa40452a7791be98dff.zip
Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4. Various tests already set their globals, but forgot to restore them afterwards, or forgot to call the parent setUp, tearDown... Either way they won't have to anymore with setMwGlobals. Consistent use of function characteristics: * protected function setUp * protected function tearDown * public static function (provide..) (Matching the function signature with PHPUnit/Framework/TestCase.php) Replaces: * public function (setUp|tearDown)\( * protected function $1( * \tfunction (setUp|tearDown)\( * \tprotected function $1( * \tfunction (data|provide)\( * \tpublic static function $1\( Also renamed a few "data#", "provider#" and "provides#" functions to "provide#" for consistency. This also removes confusion where the /media tests had a few private methods called dataFile(), which were sometimes expected to be data providers. Fixes: TimestampTest often failed due to a previous test setting a different language (it tests "1 hour ago" so need to make sure it is set to English). MWNamespaceTest became a lot cleaner now that it executes with a known context. Though the now-redundant code that was removed didn't work anyway because wgContentNamespaces isn't keyed by namespace id, it had them was values... FileBackendTest: * Fixed: "PHP Fatal: Using $this when not in object context" HttpTest * Added comment about: "PHP Fatal: Call to protected MWHttpRequest::__construct()" (too much unrelated code to fix in this commit) ExternalStoreTest * Add an assertTrue as well, without it the test is useless because regardless of whether wgExternalStores is true or false it only uses it if it is an array. Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
Diffstat (limited to 'tests/phpunit/includes/db/DatabaseSQLTest.php')
-rw-r--r--tests/phpunit/includes/db/DatabaseSQLTest.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/phpunit/includes/db/DatabaseSQLTest.php b/tests/phpunit/includes/db/DatabaseSQLTest.php
index e37cd445faa6..0c9f7495a77c 100644
--- a/tests/phpunit/includes/db/DatabaseSQLTest.php
+++ b/tests/phpunit/includes/db/DatabaseSQLTest.php
@@ -8,15 +8,15 @@
*/
class DatabaseSQLTest extends MediaWikiTestCase {
- public function setUp() {
+ protected function setUp() {
// TODO support other DBMS or find another way to do it
- if( $this->db->getType() !== 'mysql' ) {
+ if ( $this->db->getType() !== 'mysql' ) {
$this->markTestSkipped( 'No mysql database' );
}
}
/**
- * @dataProvider dataSelectSQLText
+ * @dataProvider provideSelectSQLText
*/
function testSelectSQLText( $sql, $sqlText ) {
$this->assertEquals( trim( $this->db->selectSQLText(
@@ -29,7 +29,7 @@ class DatabaseSQLTest extends MediaWikiTestCase {
) ), $sqlText );
}
- function dataSelectSQLText() {
+ public static function provideSelectSQLText() {
return array(
array(
array(
@@ -106,7 +106,7 @@ class DatabaseSQLTest extends MediaWikiTestCase {
}
/**
- * @dataProvider dataConditional
+ * @dataProvider provideConditional
*/
function testConditional( $sql, $sqlText ) {
$this->assertEquals( trim( $this->db->conditional(
@@ -116,7 +116,7 @@ class DatabaseSQLTest extends MediaWikiTestCase {
) ), $sqlText );
}
- function dataConditional() {
+ public static function provideConditional() {
return array(
array(
array(