MediaWiki REL1_30
DatabaseTestHelper Class Reference

Helper for testing the methods from the Database class. More...

Inheritance diagram for DatabaseTestHelper:
Collaboration diagram for DatabaseTestHelper:

Public Member Functions

 __construct ( $testName, array $opts=[])
 
 addIdentifierQuotes ( $s)
 
 affectedRows ()
 
 dataSeek ( $res, $row)
 
 fetchObject ( $res)
 
 fetchRow ( $res)
 
 fieldInfo ( $table, $field)
 
 fieldName ( $res, $n)
 
 forceNextResult ( $res)
 
 getLastSqls ()
 Returns SQL queries grouped by '; ' Clear the list of queries that have been done so far.
 
 getServerInfo ()
 
 getServerVersion ()
 
 getSoftwareLink ()
 
 getType ()
 
 indexInfo ( $table, $index, $fname='Database::indexInfo')
 
 insertId ()
 
 isOpen ()
 
 lastErrno ()
 
 lastError ()
 
 nativeReplace ( $table, $rows, $fname)
 
 numFields ( $res)
 
 numRows ( $res)
 
 open ( $server, $user, $password, $dbName)
 
 ping (&$rtt=null)
 
 query ( $sql, $fname='', $tempIgnore=false)
 
 setExistingTables ( $tablesExists)
 
 setUnionSupportsOrderAndLimit ( $v)
 
 strencode ( $s)
 
 tableExists ( $table, $fname=__METHOD__)
 
 unionSupportsOrderAndLimit ()
 

Protected Member Functions

 addSql ( $sql)
 
 checkFunctionName ( $fname)
 
 closeConnection ()
 
 doQuery ( $sql)
 

Protected Attributes

 $lastSqls = []
 Array of lastSqls passed to query(), This is an array since some methods in Database can do more than one query.
 
array $nextResult = []
 List of row arrays.
 
 $tablesExists
 Array of tables to be considered as existing by tableExist() Use setExistingTables() to alter.
 
 $testName = []
 CLASS of the test suite, used to determine, if the function name is passed every time to query()
 
 $unionSupportsOrderAndLimit = true
 Value to return from unionSupportsOrderAndLimit()
 

Detailed Description

Helper for testing the methods from the Database class.

Since
1.22

Definition at line 10 of file DatabaseTestHelper.php.

Constructor & Destructor Documentation

◆ __construct()

DatabaseTestHelper::__construct ( $testName,
array $opts = [] )

Definition at line 39 of file DatabaseTestHelper.php.

References $e, $testName, and wfWarn().

Member Function Documentation

◆ addIdentifierQuotes()

DatabaseTestHelper::addIdentifierQuotes ( $s)

Definition at line 97 of file DatabaseTestHelper.php.

References $s.

◆ addSql()

DatabaseTestHelper::addSql ( $sql)
protected

Definition at line 76 of file DatabaseTestHelper.php.

Referenced by query().

◆ affectedRows()

DatabaseTestHelper::affectedRows ( )

Definition at line 177 of file DatabaseTestHelper.php.

◆ checkFunctionName()

DatabaseTestHelper::checkFunctionName ( $fname)
protected

Definition at line 84 of file DatabaseTestHelper.php.

References $fname.

Referenced by query(), and tableExists().

◆ closeConnection()

DatabaseTestHelper::closeConnection ( )
protected

Definition at line 202 of file DatabaseTestHelper.php.

◆ dataSeek()

DatabaseTestHelper::dataSeek ( $res,
$row )

Definition at line 157 of file DatabaseTestHelper.php.

◆ doQuery()

DatabaseTestHelper::doQuery ( $sql)
protected

Definition at line 206 of file DatabaseTestHelper.php.

References $nextResult, and $res.

◆ fetchObject()

DatabaseTestHelper::fetchObject ( $res)

Definition at line 133 of file DatabaseTestHelper.php.

◆ fetchRow()

DatabaseTestHelper::fetchRow ( $res)

Definition at line 137 of file DatabaseTestHelper.php.

◆ fieldInfo()

DatabaseTestHelper::fieldInfo ( $table,
$field )

Definition at line 169 of file DatabaseTestHelper.php.

◆ fieldName()

DatabaseTestHelper::fieldName ( $res,
$n )

Definition at line 149 of file DatabaseTestHelper.php.

◆ forceNextResult()

DatabaseTestHelper::forceNextResult ( $res)
Parameters
mixed$resUse an array of row arrays to set row result

Definition at line 72 of file DatabaseTestHelper.php.

References $res.

◆ getLastSqls()

DatabaseTestHelper::getLastSqls ( )

Returns SQL queries grouped by '; ' Clear the list of queries that have been done so far.

Returns
string

Definition at line 58 of file DatabaseTestHelper.php.

References $lastSqls.

Referenced by DatabaseSQLTest\assertLastSqlDb().

◆ getServerInfo()

DatabaseTestHelper::getServerInfo ( )

Definition at line 189 of file DatabaseTestHelper.php.

◆ getServerVersion()

DatabaseTestHelper::getServerVersion ( )

Definition at line 185 of file DatabaseTestHelper.php.

◆ getSoftwareLink()

DatabaseTestHelper::getSoftwareLink ( )

Definition at line 181 of file DatabaseTestHelper.php.

◆ getType()

DatabaseTestHelper::getType ( )

Definition at line 125 of file DatabaseTestHelper.php.

◆ indexInfo()

DatabaseTestHelper::indexInfo ( $table,
$index,
$fname = 'Database::indexInfo' )

Definition at line 173 of file DatabaseTestHelper.php.

◆ insertId()

DatabaseTestHelper::insertId ( )

Definition at line 153 of file DatabaseTestHelper.php.

◆ isOpen()

DatabaseTestHelper::isOpen ( )

Definition at line 193 of file DatabaseTestHelper.php.

◆ lastErrno()

DatabaseTestHelper::lastErrno ( )

Definition at line 161 of file DatabaseTestHelper.php.

◆ lastError()

DatabaseTestHelper::lastError ( )

Definition at line 165 of file DatabaseTestHelper.php.

◆ nativeReplace()

DatabaseTestHelper::nativeReplace ( $table,
$rows,
$fname )

Definition at line 121 of file DatabaseTestHelper.php.

References $fname, and $rows.

◆ numFields()

DatabaseTestHelper::numFields ( $res)

Definition at line 145 of file DatabaseTestHelper.php.

◆ numRows()

DatabaseTestHelper::numRows ( $res)

Definition at line 141 of file DatabaseTestHelper.php.

◆ open()

DatabaseTestHelper::open ( $server,
$user,
$password,
$dbName )

Definition at line 129 of file DatabaseTestHelper.php.

◆ ping()

DatabaseTestHelper::ping ( & $rtt = null)

Definition at line 197 of file DatabaseTestHelper.php.

◆ query()

DatabaseTestHelper::query ( $sql,
$fname = '',
$tempIgnore = false )

Definition at line 102 of file DatabaseTestHelper.php.

References $fname, addSql(), and checkFunctionName().

◆ setExistingTables()

DatabaseTestHelper::setExistingTables ( $tablesExists)

Definition at line 65 of file DatabaseTestHelper.php.

References $tablesExists, and array().

◆ setUnionSupportsOrderAndLimit()

DatabaseTestHelper::setUnionSupportsOrderAndLimit ( $v)

Definition at line 217 of file DatabaseTestHelper.php.

References unionSupportsOrderAndLimit().

◆ strencode()

DatabaseTestHelper::strencode ( $s)

Definition at line 92 of file DatabaseTestHelper.php.

References $s.

◆ tableExists()

DatabaseTestHelper::tableExists ( $table,
$fname = __METHOD__ )

Definition at line 109 of file DatabaseTestHelper.php.

References $fname, checkFunctionName(), and tableName().

◆ unionSupportsOrderAndLimit()

DatabaseTestHelper::unionSupportsOrderAndLimit ( )

Definition at line 213 of file DatabaseTestHelper.php.

References $unionSupportsOrderAndLimit.

Referenced by setUnionSupportsOrderAndLimit().

Member Data Documentation

◆ $lastSqls

DatabaseTestHelper::$lastSqls = []
protected

Array of lastSqls passed to query(), This is an array since some methods in Database can do more than one query.

Cleared when calling getLastSqls().

Definition at line 23 of file DatabaseTestHelper.php.

Referenced by getLastSqls().

◆ $nextResult

array DatabaseTestHelper::$nextResult = []
protected

List of row arrays.

Definition at line 26 of file DatabaseTestHelper.php.

Referenced by doQuery().

◆ $tablesExists

DatabaseTestHelper::$tablesExists
protected

Array of tables to be considered as existing by tableExist() Use setExistingTables() to alter.

Definition at line 32 of file DatabaseTestHelper.php.

Referenced by setExistingTables().

◆ $testName

DatabaseTestHelper::$testName = []
protected

CLASS of the test suite, used to determine, if the function name is passed every time to query()

Definition at line 16 of file DatabaseTestHelper.php.

Referenced by __construct().

◆ $unionSupportsOrderAndLimit

DatabaseTestHelper::$unionSupportsOrderAndLimit = true
protected

Value to return from unionSupportsOrderAndLimit()

Definition at line 37 of file DatabaseTestHelper.php.

Referenced by unionSupportsOrderAndLimit().


The documentation for this class was generated from the following file: