class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable (View source)

Doctrine mock connection adapter. This class is used for special testing purposes.

Methods

void
__construct(string $name = null)

Doctrine mock adapter constructor

string
getName()

Get the name of the dbms used in this instance of the mock adapter

string
pop()

Pop the last executed query from the array of executed queries and return it

void
forceException(string $name, string $message = '', integer $code = 0)

Force an exception in to the array of exceptions

prepare(string $query)

Prepare a query statement

void
addQuery(string $query)

Add query to the stack of executed queries

query(string $query)

Fake the execution of query and add it to the stack of executed queries

array
getAll()

Get all the executed queries

quote($input)

Quote a value for the dbms

exec($statement)

Execute a raw sql statement

void
forceLastInsertIdFail(boolean $fail = true)

Force last insert to be failed

lastInsertId()

Get the id of the last inserted record

integer
count()

Get the number of queries executed

beginTransaction()

Begin a transaction

commit()

Commit a transaction

rollBack()

Rollback a transaction

getAttribute($attribute)

No description

errorCode()

No description

errorInfo()

No description

setAttribute($attribute, $value)

No description

sqliteCreateFunction()

No description

Details

void __construct(string $name = null)

Doctrine mock adapter constructor

$conn = new Doctrine_Adapter_Mock('mysql');

Parameters

string $name

Return Value

void

string getName()

Get the name of the dbms used in this instance of the mock adapter

Return Value

string $name Name of the dbms

string pop()

Pop the last executed query from the array of executed queries and return it

Return Value

string $sql Last executed sql string

void forceException(string $name, string $message = '', integer $code = 0)

Force an exception in to the array of exceptions

Parameters

string $name Name of exception
string $message Message for the exception
integer $code Code of the exception

Return Value

void

prepare(string $query)

Prepare a query statement

Parameters

string $query Query to prepare

void addQuery(string $query)

Add query to the stack of executed queries

Parameters

string $query

Return Value

void

query(string $query)

Fake the execution of query and add it to the stack of executed queries

Parameters

string $query

array getAll()

Get all the executed queries

Return Value

array $queries Array of all executed queries

quote($input)

Quote a value for the dbms

Parameters

$input

exec($statement)

Execute a raw sql statement

Parameters

$statement

void forceLastInsertIdFail(boolean $fail = true)

Force last insert to be failed

Parameters

boolean $fail

Return Value

void

lastInsertId()

Get the id of the last inserted record

integer count()

Get the number of queries executed

Return Value

integer $count

beginTransaction()

Begin a transaction

commit()

Commit a transaction

rollBack()

Rollback a transaction

getAttribute($attribute)

Parameters

$attribute

errorCode()

errorInfo()

setAttribute($attribute, $value)

Parameters

$attribute
$value

sqliteCreateFunction()