PHP Class Elgg\Mocks\Database

Inheritance: extends Elgg\Database
Show file Open project: elgg/elgg Class Usage Examples

Public Properties

Property Type Description
$last_insert_id integer

Public Methods

Method Description
__construct ( Elgg\Database\Config $config, Logger $logger = null )
addQuerySpec ( array $spec ) : integer Set the result of a query that may be called in the future
clearQuerySpecs ( ) : void Remove all query specifications
connect ( $type = "readwrite" )
executeDatabaseQuery ( string $sql, array $params = [] ) : PHPUnit_Framework_MockObject_MockObject Execute database query
getConnection ( $type )
removeQuerySpec ( integer $id ) : void Remove a specified query added by addQuerySpec()
sanitizeString ( $value )
setupConnections ( )

Private Methods

Method Description
normalizeSql ( string $query ) : string Attempt to normalize whitespace in a query

Method Details

__construct() public method

public __construct ( Elgg\Database\Config $config, Logger $logger = null )
$config Elgg\Database\Config
$logger Elgg\Logger

addQuerySpec() public method

Set the result of a query that may be called in the future
public addQuerySpec ( array $spec ) : integer
$spec array Query spec
return integer ID of spec

clearQuerySpecs() public method

Remove all query specifications
public clearQuerySpecs ( ) : void
return void

connect() public method

public connect ( $type = "readwrite" )

executeDatabaseQuery() public method

Execute database query
public executeDatabaseQuery ( string $sql, array $params = [] ) : PHPUnit_Framework_MockObject_MockObject
$sql string Query
$params array Query params
return PHPUnit_Framework_MockObject_MockObject (statement)

getConnection() public method

public getConnection ( $type )

removeQuerySpec() public method

Remove a specified query added by addQuerySpec()
public removeQuerySpec ( integer $id ) : void
$id integer Query spec ID
return void

sanitizeString() public method

public sanitizeString ( $value )

setupConnections() public method

public setupConnections ( )

Property Details

$last_insert_id public property

public int $last_insert_id
return integer