Inherits Doctrine_Adapter_Interface, and Countable.
Definition at line 33 of file Mock.php.
| Doctrine_Adapter_Mock::__construct |
( |
|
$name = null | ) |
|
| Doctrine_Adapter_Mock::addQuery |
( |
|
$query | ) |
|
Add query to the stack of executed queries
- Parameters
-
- Returns
- void
Definition at line 131 of file Mock.php.
{
$this->_queries[] = $query;
}
| Doctrine_Adapter_Mock::beginTransaction |
( |
| ) |
|
Begin a transaction
- Returns
- void
Definition at line 251 of file Mock.php.
{
$this->_queries[] = 'BEGIN TRANSACTION';
}
| Doctrine_Adapter_Mock::commit |
( |
| ) |
|
Commit a transaction
- Returns
- void
Definition at line 261 of file Mock.php.
{
$this->_queries[] = 'COMMIT';
}
| Doctrine_Adapter_Mock::count |
( |
| ) |
|
Get the number of queries executed
- Returns
- integer $count
Definition at line 241 of file Mock.php.
{
return count($this->_queries);
}
| Doctrine_Adapter_Mock::exec |
( |
|
$statement | ) |
|
Execute a raw sql statement
- Parameters
-
- Returns
- void
Definition at line 189 of file Mock.php.
{
$this->_queries[] = $statement;
$e = $this->_exception;
if ( ! empty($e)) {
$name = $e[0];
$this->_exception = array();
throw new $name($e[1], $e[2]);
}
return 0;
}
| Doctrine_Adapter_Mock::forceException |
( |
|
$name, |
|
|
|
$message = '', |
|
|
|
$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 |
- Returns
- void
Definition at line 106 of file Mock.php.
{
$this->_exception = array($name, $message, $code);
}
| Doctrine_Adapter_Mock::forceLastInsertIdFail |
( |
|
$fail = true | ) |
|
Force last insert to be failed
- Parameters
-
- Returns
- void
Definition at line 212 of file Mock.php.
{
if ($fail) {
$this->_lastInsertIdFail = true;
} else {
$this->_lastInsertIdFail = false;
}
}
| Doctrine_Adapter_Mock::getAll |
( |
| ) |
|
Get all the executed queries
- Returns
- array $queries Array of all executed queries
Definition at line 167 of file Mock.php.
{
return $this->_queries;
}
| Doctrine_Adapter_Mock::getName |
( |
| ) |
|
Get the name of the dbms used in this instance of the mock adapter
- Returns
- string $name Name of the dbms
Definition at line 83 of file Mock.php.
| Doctrine_Adapter_Mock::lastInsertId |
( |
| ) |
|
Get the id of the last inserted record
- Returns
- integer $id
Definition at line 226 of file Mock.php.
{
$this->_queries[] = 'LAST_INSERT_ID()';
if ($this->_lastInsertIdFail) {
return null;
} else {
return 1;
}
}
| Doctrine_Adapter_Mock::pop |
( |
| ) |
|
Pop the last executed query from the array of executed queries and return it
- Returns
- string $sql Last executed sql string
Definition at line 93 of file Mock.php.
{
return array_pop($this->_queries);
}
| Doctrine_Adapter_Mock::prepare |
( |
|
$query | ) |
|
Prepare a query statement
- Parameters
-
| string | $query | Query to prepare |
- Returns
- Doctrine_Adapter_Statement_Mock $mock Mock prepared statement
Definition at line 117 of file Mock.php.
{
$mock->queryString = $query;
return $mock;
}
| Doctrine_Adapter_Mock::query |
( |
|
$query | ) |
|
Fake the execution of query and add it to the stack of executed queries
- Parameters
-
- Returns
- Doctrine_Adapter_Statement_Mock $stmt
Definition at line 142 of file Mock.php.
{
$this->_queries[] = $query;
$e = $this->_exception;
if ( ! empty($e)) {
$name = $e[0];
$this->_exception = array();
throw new $name($e[1], $e[2]);
}
$stmt->queryString = $query;
return $stmt;
}
| Doctrine_Adapter_Mock::quote |
( |
|
$input | ) |
|
Quote a value for the dbms
- Parameters
-
- Returns
- string $quoted
Definition at line 178 of file Mock.php.
{
return "'" . addslashes($input) . "'";
}
| Doctrine_Adapter_Mock::rollBack |
( |
| ) |
|
Rollback a transaction
- Returns
- void
Definition at line 271 of file Mock.php.
{
$this->_queries[] = 'ROLLBACK';
}
The documentation for this class was generated from the following file:
- Doctrine-1.2.4/Doctrine/Adapter/Mock.php