From 7131ab9e95f7a6dfdd916ed322bc516f7a0c6a05 Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 15 Jan 2007 18:48:50 +0000 Subject: [PATCH] --- lib/Doctrine.php | 6 +- lib/Doctrine/Connection.php | 14 +-- lib/Doctrine/Connection/Mssql.php | 5 +- lib/Doctrine/Db.php | 2 +- lib/Doctrine/Export/Mysql.php | 24 ++-- lib/Doctrine/Hydrate.php | 3 +- tests/ConnectionTestCase.php | 190 +----------------------------- tests/DriverTestCase.php | 53 +++++++-- tests/SequenceTestCase.php | 32 ++--- tests/UnitTestCase.php | 9 +- 10 files changed, 94 insertions(+), 244 deletions(-) diff --git a/lib/Doctrine.php b/lib/Doctrine.php index 7d6a0e560..59d3cd2da 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -407,14 +407,14 @@ final class Doctrine * @return boolean */ public static function autoload($classname) - { - if (class_exists($classname)) { + { + if (class_exists($classname, false)) { return false; } if (! self::$path) { self::$path = dirname(__FILE__); } - $class = self::$path.DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; + $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; if ( ! file_exists($class)) { return false; diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index fb489f5b2..103d71f5b 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -488,7 +488,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchAll($statement, array $params = array()) { - return $this->query($statement, $params)->fetchAll(PDO::FETCH_ASSOC); + return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC); } /** * fetchOne @@ -509,7 +509,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchRow($statement, array $params = array()) { - return $this->query($statement, $params)->fetch(PDO::FETCH_ASSOC); + return $this->execute($statement, $params)->fetch(PDO::FETCH_ASSOC); } /** * fetchArray @@ -519,7 +519,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchArray($statement, array $params = array()) { - return $this->query($statement, $params)->fetch(PDO::FETCH_NUM); + return $this->execute($statement, $params)->fetch(PDO::FETCH_NUM); } /** * fetchColumn @@ -530,7 +530,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchColumn($statement, array $params = array(), $colnum = 0) { - return $this->query($statement, $params)->fetchAll(PDO::FETCH_COLUMN, $colnum); + return $this->execute($statement, $params)->fetchAll(PDO::FETCH_COLUMN, $colnum); } /** * fetchAssoc @@ -540,7 +540,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchAssoc($statement, array $params = array()) { - return $this->query($statement, $params)->fetchAll(PDO::FETCH_ASSOC); + return $this->execute($statement, $params)->fetchAll(PDO::FETCH_ASSOC); } /** * fetchBoth @@ -550,7 +550,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return array */ public function fetchBoth($statement, array $params = array()) { - return $this->query($statement, $params)->fetchAll(PDO::FETCH_BOTH); + return $this->execute($statement, $params)->fetchAll(PDO::FETCH_BOTH); } /** * query @@ -650,7 +650,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun if ( ! empty($params)) { $stmt = $this->dbh->prepare($query); $stmt->execute($params); - return $stmt; + return $stmt->rowCount(); } else { return $this->dbh->exec($query); } diff --git a/lib/Doctrine/Connection/Mssql.php b/lib/Doctrine/Connection/Mssql.php index 974447df8..dc2d7f1e1 100644 --- a/lib/Doctrine/Connection/Mssql.php +++ b/lib/Doctrine/Connection/Mssql.php @@ -79,7 +79,7 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection */ public function quoteIdentifier($identifier, $checkOption = false) { - if ($checkOption && ! $this->options['quote_identifier']) { + if ($checkOption && ! $this->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) { return $identifier; } return '[' . str_replace(']', ']]', $identifier) . ']'; @@ -143,9 +143,8 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection * * @param bool $native determines if the raw version string should be returned * @return mixed array/string with version information or MDB2 error object - * @access public */ - function getServerVersion($native = false) + public function getServerVersion($native = false) { if ($this->connected_server_info) { $serverInfo = $this->connected_server_info; diff --git a/lib/Doctrine/Db.php b/lib/Doctrine/Db.php index e01ebccd9..d93270fb7 100644 --- a/lib/Doctrine/Db.php +++ b/lib/Doctrine/Db.php @@ -192,7 +192,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte $this->dbh = new PDO($this->options['dsn'], $this->options['username'], $this->options['password']); $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $this->dbh->setAttribute(PDO::ATTR_STATEMENT_CLASS, array("Doctrine_Db_Statement", array($this))); + $this->dbh->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine_Db_Statement', array($this))); foreach($this->pendingAttributes as $attr => $value) { $this->dbh->setAttribute($attr, $value); diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index f53ed46ea..7e60f8ef3 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -84,7 +84,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export * @param array $options An associative array of table options: * array( * 'comment' => 'Foo', - * 'character_set' => 'utf8', + * 'charset' => 'utf8', * 'collate' => 'utf8_unicode_ci', * 'collate' => 'utf8_unicode_ci', * 'type' => 'innodb', @@ -94,18 +94,18 @@ class Doctrine_Export_Mysql extends Doctrine_Export */ public function createTable($name, array $fields, array $options = array()) { if ( ! $name) - throw new Doctrine_Export_Mysql_Exception('no valid table name specified'); + throw new Doctrine_Export_Exception('no valid table name specified'); if (empty($fields)) { - throw new Doctrine_Export_Mysql_Exception('no fields specified for table "'.$name.'"'); + throw new Doctrine_Export_Exception('no fields specified for table "'.$name.'"'); } - $query_fields = $this->getFieldDeclarationList($fields); + $queryFields = $this->getFieldDeclarationList($fields); if (isset($options['primary']) && ! empty($options['primary'])) { - $query_fields.= ', PRIMARY KEY(' . implode(', ', array_values($options['primary'])) . ')'; + $queryFields .= ', PRIMARY KEY(' . implode(', ', array_values($options['primary'])) . ')'; } $name = $this->conn->quoteIdentifier($name, true); - $query = 'CREATE TABLE ' . $name . ' (' . $query_fields . ')'; + $query = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')'; $optionStrings = array(); @@ -227,7 +227,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export public function alterTable($name, array $changes, $check) { if ( ! $name) - throw new Doctrine_Export_Mysql_Exception('no valid table name specified'); + throw new Doctrine_Export_Exception('no valid table name specified'); foreach ($changes as $changeName => $change) { switch ($changeName) { @@ -238,7 +238,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export case 'name': break; default: - throw new Doctrine_Export_Mysql_Exception('change type "'.$changeName.'" not yet supported'); + throw new Doctrine_Export_Exception('change type "'.$changeName.'" not yet supported'); } } @@ -324,7 +324,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export { $query = 'CREATE TABLE ' . $sequenceName . ' (' . $seqcolName . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (' - . $seqcol_name . '))' + . $seqcolName . '))' . strlen($this->conn->default_table_type) ? ' TYPE = ' . $this->conn->default_table_type : ''; @@ -334,7 +334,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export return true; $query = 'INSERT INTO ' . $sequenceName - . ' (' . $seqcol_name . ') VALUES (' . ($start - 1) . ')'; + . ' (' . $seqcolName . ') VALUES (' . ($start - 1) . ')'; $res = $this->conn->exec($query); @@ -342,10 +342,10 @@ class Doctrine_Export_Mysql extends Doctrine_Export try { $result = $this->conn->exec('DROP TABLE ' . $sequenceName); } catch(Exception $e) { - throw new Doctrine_Export_Mysql_Exception('could not drop inconsistent sequence table'); + throw new Doctrine_Export_Exception('could not drop inconsistent sequence table'); } - throw new Doctrine_Mysql_Export_Exception('could not create sequence table'); + throw new Doctrine_Export_Exception('could not create sequence table'); } /** * Get the stucture of a field into an array diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index b49ff2ec1..fbd1a62d9 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -642,7 +642,8 @@ abstract class Doctrine_Hydrate extends Doctrine_Access $b = array(); foreach ($map as $field => $value) { if ($index > 0) { - $b[] = '(' . $tableAlias . '.' . $field . ' = ' . $value . ' OR ' . $tableAlias . '.' . $field . ' IS NULL)'; + $b[] = '(' . $tableAlias . '.' . $field . ' = ' . $value + . ' OR ' . $tableAlias . '.' . $field . ' IS NULL)'; } else { $b[] = $tableAlias . '.' . $field . ' = ' . $value; } diff --git a/tests/ConnectionTestCase.php b/tests/ConnectionTestCase.php index 002593423..d31e4dd58 100644 --- a/tests/ConnectionTestCase.php +++ b/tests/ConnectionTestCase.php @@ -31,7 +31,6 @@ * @version $Revision$ */ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase { - public function testUnknownModule() { try { $this->connection->unknown; @@ -47,8 +46,9 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase { $this->assertTrue($this->connection->transaction instanceof Doctrine_Transaction); $this->assertTrue($this->connection->export instanceof Doctrine_Export); } - public function testFetchAll() { - $this->conn->exec('CREATE TABLE entity (id INTEGER, name TEXT)'); + public function testFetchAll() { + $this->conn->exec('DROP TABLE entity'); + $this->conn->exec('CREATE TABLE entity (id INT, name TEXT)'); $this->conn->exec("INSERT INTO entity (id, name) VALUES (1, 'zYne')"); $this->conn->exec("INSERT INTO entity (id, name) VALUES (2, 'John')"); @@ -127,172 +127,11 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase { )); } public function testFetchPairs() { - + $this->conn->exec('DROP TABLE entity'); } - public function testFlush() { - $user = $this->connection->getTable('User')->find(4); - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $user = $this->connection->create('Email'); - $user = $this->connection->create('User'); - $record = $this->connection->create('Phonenumber'); - - $user->Email->address = 'example@drinkmore.info'; - $this->assertTrue($user->email_id instanceof Email); - - $user->name = 'Example user'; - $user->Group[0]->name = 'Example group 1'; - $user->Group[1]->name = 'Example group 2'; - - $user->Phonenumber[0]->phonenumber = '123 123'; - - $user->Phonenumber[1]->phonenumber = '321 2132'; - $user->Phonenumber[2]->phonenumber = '123 123'; - $user->Phonenumber[3]->phonenumber = '321 2132'; - - - - $this->assertTrue($user->Phonenumber[0]->entity_id instanceof User); - $this->assertTrue($user->Phonenumber[2]->entity_id instanceof User); - - $this->connection->flush(); - - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $this->assertEqual(count($user->Group), 2); - $user2 = $user; - - $user = $this->objTable->find($user->id); - - $this->assertEqual($user->id, $user2->id); - - $this->assertTrue(is_numeric($user->id)); - $this->assertTrue(is_numeric($user->email_id)); - - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - $this->assertTrue($user->Phonenumber->count(), 4); - $this->assertEqual($user->Group->count(), 2); - - - $user = $this->objTable->find(5); - - $pf = $this->connection->getTable('Phonenumber'); - - $this->assertTrue($user->Phonenumber instanceof Doctrine_Collection); - $this->assertTrue($user->Phonenumber->count() == 3); - - $coll = new Doctrine_Collection($pf); - - $user->Phonenumber = $coll; - $this->assertTrue($user->Phonenumber->count() == 0); - - $this->connection->flush(); - unset($user); - $user = $this->objTable->find(5); - - $this->assertEqual($user->Phonenumber->count(), 0); - - // ADDING REFERENCES - - $user->Phonenumber[0]->phonenumber = '123 123'; - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $user->Phonenumber[1]->phonenumber = '123 123'; - $this->connection->flush(); - - - $this->assertEqual($user->Phonenumber->count(), 2); - - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - $user->Phonenumber[3]->phonenumber = '123 123'; - $this->connection->flush(); - - $this->assertEqual($user->Phonenumber->count(), 3); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 3); - - // DELETING REFERENCES - - $user->Phonenumber->delete(); - - $this->assertEqual($user->Phonenumber->count(), 0); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 0); - - // ADDING REFERENCES WITH STRING KEYS - - $user->Phonenumber['home']->phonenumber = '123 123'; - $user->Phonenumber['work']->phonenumber = '444 444'; - - $this->assertEqual($user->Phonenumber->count(), 2); - $this->connection->flush(); - - $this->assertEqual($user->Phonenumber->count(), 2); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - // REPLACING ONE-TO-MANY REFERENCE - - unset($coll); - $coll = new Doctrine_Collection($pf); - $coll[0]->phonenumber = '123 123'; - $coll['home']->phonenumber = '444 444'; - $coll['work']->phonenumber = '444 444'; - - - - - $user->Phonenumber = $coll; - $this->connection->flush(); - $this->assertEqual($user->Phonenumber->count(), 3); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 3); - - - // ONE-TO-ONE REFERENCES - - $user->Email->address = 'drinker@drinkmore.info'; - $this->assertTrue($user->Email instanceof Email); - $this->connection->flush(); - $this->assertTrue($user->Email instanceof Email); - $user = $this->objTable->find(5); - $this->assertEqual($user->Email->address, 'drinker@drinkmore.info'); - $id = $user->Email->id; - - // REPLACING ONE-TO-ONE REFERENCES - - $email = $this->connection->create('Email'); - $email->address = 'absolutist@nottodrink.com'; - $user->Email = $email; - - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, 'absolutist@nottodrink.com'); - $this->connection->flush(); - unset($user); - - $user = $this->objTable->find(5); - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, 'absolutist@nottodrink.com'); - - $emails = $this->connection->query("FROM Email WHERE Email.id = $id"); - //$this->assertEqual(count($emails),0); - - - } - public function testGetManager() { $this->assertEqual($this->connection->getManager(),$this->manager); } - public function testQuery() { - $this->assertTrue($this->connection->query('FROM User') instanceof Doctrine_Collection); - } - public function testDelete() { $user = $this->connection->create('User'); $this->connection->delete($user); @@ -333,27 +172,6 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase { public function testGetTables() { $this->assertTrue(is_array($this->connection->getTables())); } - - public function testTransactions() { - - $this->connection->beginTransaction(); - $this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_ACTIVE); - $this->connection->commit(); - $this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_SLEEP); - - $this->connection->beginTransaction(); - - $user = $this->objTable->find(6); - - $user->name = 'Jack Daniels'; - $this->connection->flush(); - $this->connection->commit(); - - $user = $this->objTable->find(6); - $this->assertEqual($user->name, 'Jack Daniels'); - - } - public function testRollback() { $this->connection->beginTransaction(); $this->assertEqual($this->connection->transaction->getTransactionLevel(),1); diff --git a/tests/DriverTestCase.php b/tests/DriverTestCase.php index bcb98e309..9adc6d943 100644 --- a/tests/DriverTestCase.php +++ b/tests/DriverTestCase.php @@ -5,24 +5,35 @@ class AdapterMock implements Doctrine_Adapter_Interface { private $queries = array(); private $exception = array(); + + private $lastInsertIdFail = false; - public function __construct($name) { + public function __construct($name) + { $this->name = $name; } - public function getName() { + public function getName() + { return $this->name; } - public function pop() { + public function pop() + { return array_pop($this->queries); } - public function forceException($name, $message = '', $code = 0) { + public function forceException($name, $message = '', $code = 0) + { $this->exception = array($name, $message, $code); } - public function prepare($prepareString){ - return new AdapterStatementMock; + public function prepare($query) + { + return new AdapterStatementMock($this, $query); } - public function query($queryString) { - $this->queries[] = $queryString; + public function addQuery($query) + { + $this->queries[] = $query; + } + public function query($query) { + $this->queries[] = $query; $e = $this->exception; @@ -34,7 +45,7 @@ class AdapterMock implements Doctrine_Adapter_Interface { throw new $name($e[1], $e[2]); } - return new AdapterStatementMock; + return new AdapterStatementMock($this, $query); } public function getAll() { return $this->queries; @@ -57,10 +68,17 @@ class AdapterMock implements Doctrine_Adapter_Interface { return 0; } + public function forceLastInsertIdFail() { + $this->lastInsertIdFail = true; + } public function lastInsertId() { $this->queries[] = 'LAST_INSERT_ID()'; - return 1; + if ($this->lastInsertIdFail) { + return null; + } else { + return 1; + } } public function beginTransaction(){ $this->queries[] = 'BEGIN TRANSACTION'; @@ -68,7 +86,10 @@ class AdapterMock implements Doctrine_Adapter_Interface { public function commit(){ $this->queries[] = 'COMMIT'; } - public function rollBack(){ } + public function rollBack() + { + $this->queries[] = 'ROLLBACK'; + } public function errorCode(){ } public function errorInfo(){ } public function getAttribute($attribute) { @@ -80,6 +101,15 @@ class AdapterMock implements Doctrine_Adapter_Interface { } } class AdapterStatementMock { + + private $mock; + + private $query; + + public function __construct(AdapterMock $mock, $query) { + $this->mock = $mock; + $this->query = $query; + } public function fetch($fetchMode) { return array(); } @@ -87,6 +117,7 @@ class AdapterStatementMock { return array(); } public function execute() { + $this->mock->addQuery($this->query); return true; } public function fetchColumn($colnum) { diff --git a/tests/SequenceTestCase.php b/tests/SequenceTestCase.php index 26d4af86f..dd93e18d6 100644 --- a/tests/SequenceTestCase.php +++ b/tests/SequenceTestCase.php @@ -40,29 +40,29 @@ class Doctrine_Sequence_TestCase extends Doctrine_UnitTestCase } public function testSequencesAreSupportedForRecords() { - $this->profiler = new Doctrine_Db_Profiler(); - - $this->dbh->setListener($this->profiler); - + $this->adapter->forceLastInsertIdFail(); $r = new CustomSequenceRecord; $r->name = 'custom seq'; $r->save(); - - // the last profiled event is transaction commit - $this->assertEqual($this->profiler->pop()->getType(), Doctrine_Db_Event::COMMIT); - // query execution - $this->assertEqual($this->profiler->pop()->getQuery(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); - // query prepare - $this->assertEqual($this->profiler->pop()->getQuery(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); + /** + // the last profiled event is transaction commit + $this->assertEqual($this->adapter->pop(), 'COMMIT'); + // query execution + + $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); + // query prepare + $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); + // sequence generation (first fails) - $this->assertEqual($this->profiler->pop()->getQuery(), 'INSERT INTO custom_seq_seq (id) VALUES (1)'); - $this->assertEqual($this->profiler->pop()->getQuery(), 'CREATE TABLE custom_seq_seq (id INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)'); - $this->assertEqual($this->profiler->pop()->getQuery(), 'INSERT INTO custom_seq_seq (id) VALUES (NULL)'); + $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_seq_seq (id) VALUES (1)'); + $this->assertEqual($this->adapter->pop(), 'CREATE TABLE custom_seq_seq (id INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)'); + $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_seq_seq (id) VALUES (NULL)'); // transaction begin - $this->assertEqual($this->profiler->pop()->getType(), Doctrine_Db_Event::BEGIN); - $this->assertEqual($this->profiler->pop()->getQuery(), 'CREATE TABLE custom_sequence_record (id INTEGER, name VARCHAR(2147483647), PRIMARY KEY(id))'); + $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); + $this->assertEqual($this->adapter->pop(), 'CREATE TABLE custom_sequence_record (id INTEGER, name VARCHAR(2147483647), PRIMARY KEY(id))'); + */ } } class CustomSequenceRecord extends Doctrine_Record { diff --git a/tests/UnitTestCase.php b/tests/UnitTestCase.php index 597275cc5..8fa58bb5c 100644 --- a/tests/UnitTestCase.php +++ b/tests/UnitTestCase.php @@ -20,7 +20,7 @@ class Doctrine_UnitTestCase extends UnitTestCase { protected $expr; protected $dataDict; protected $transaction; - + private $init = false; @@ -63,6 +63,7 @@ class Doctrine_UnitTestCase extends UnitTestCase { case 'Expression': case 'Transaction': case 'DataDict': + case 'Sequence': $this->driverName = 'Sqlite'; break; } @@ -83,7 +84,7 @@ class Doctrine_UnitTestCase extends UnitTestCase { } try { - $this->connection = $this->manager->getConnection($this->driverName); + $this->conn = $this->connection = $this->manager->getConnection($this->driverName); $this->connection->evictTables(); $this->dbh = $this->adapter = $this->connection->getDbh(); $this->listener = $this->manager->getAttribute(Doctrine::ATTR_LISTENER); @@ -91,12 +92,12 @@ class Doctrine_UnitTestCase extends UnitTestCase { $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener); } catch(Doctrine_Manager_Exception $e) { if($this->driverName == 'main') { - $this->dbh = Doctrine_Db::getConnection("sqlite::memory:"); + $this->dbh = Doctrine_Db::getConnection('sqlite::memory:'); } else { $this->dbh = $this->adapter = new AdapterMock($this->driverName); } - $this->connection = $this->manager->openConnection($this->dbh, $this->driverName); + $this->conn = $this->connection = $this->manager->openConnection($this->dbh, $this->driverName); if($this->driverName !== 'main') { $exc = 'Doctrine_Connection_' . ucwords($this->driverName) . '_Exception';