From 847bd1ade6c4ee0ad858519d321c2955e6597bab Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 6 Oct 2006 16:50:00 +0000 Subject: [PATCH] new attribute: Doctrine::ATTR_ACCESSORS, DQL subquery support, accessor invoking support --- lib/Doctrine.php | 54 ++++---------- lib/Doctrine/Configurable.php | 11 ++- lib/Doctrine/Connection/Sqlite.php | 72 +++++++++++++++++-- lib/Doctrine/Manager.php | 17 ++--- lib/Doctrine/Manager/Exception.php | 28 +++++++- lib/Doctrine/Query.php | 2 +- lib/Doctrine/Query/From.php | 2 +- lib/Doctrine/Query/Where.php | 21 +++--- lib/Doctrine/Record.php | 25 ++++--- lib/Doctrine/Table.php | 49 ++++++++++++- ...octrine Query Language) - Introduction.php | 28 ++++++++ ...le definition - Table and class naming.php | 9 +++ manual/documentation.php | 43 +++++++---- tests/EventListenerTestCase.php | 42 ++--------- tests/QuerySubqueryTestCase.php | 16 +++++ tests/RecordFilterTestCase.php | 63 ++++++++++++++++ tests/run.php | 7 ++ 17 files changed, 359 insertions(+), 130 deletions(-) create mode 100644 tests/QuerySubqueryTestCase.php create mode 100644 tests/RecordFilterTestCase.php diff --git a/lib/Doctrine.php b/lib/Doctrine.php index 42b66be50..8f68bb770 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -145,6 +145,10 @@ final class Doctrine { * query limit */ const ATTR_QUERY_LIMIT = 17; + /** + * accessor invoking attribute + */ + const ATTR_ACCESSORS = 18; /** @@ -213,54 +217,24 @@ final class Doctrine { */ const FETCH_ARRAY = 3; + + /** - * FETCH COLUMN - * Specifies that the fetch method shall return only a single - * requested column from the next row in the result set. - * + * ACCESSOR CONSTANTS */ - const FETCH_COLUMN = 4; + /** - * FETCH ASSOC - * - * Specifies that the fetch method shall return each row as an - * array indexed by column name as returned in the corresponding - * result set. If the result set contains multiple columns with - * the same name, PDO::FETCH_ASSOC returns only a single value per column name. - * + * constant for get accessors */ - const FETCH_ASSOC = 5; + const ACCESSOR_GET = 1; /** - * FETCH NAMED - * - * Specifies that the fetch method shall return each row as an array indexed - * by column name as returned in the corresponding result set. If the result set - * contains multiple columns with the same name, PDO::FETCH_NAMED returns an - * array of values per column name. - * + * constant for set accessors */ - const FETCH_NAMED = 6; + const ACCESSOR_SET = 2; /** - * FETCH NUM - * - * Specifies that the fetch method shall return each row as an array indexed by - * column number as returned in the corresponding result set, starting at column 0. + * constant for both accessors get and set */ - const FETCH_NUM = 7; - /** - * FETCH BOTH - * - * Specifies that the fetch method shall return each row as an array indexed by both - * column name and number as returned in the corresponding result set, starting at column 0. - */ - const FETCH_BOTH = 8; - /** - * FETCH OBJ - * - * Specifies that the fetch method shall return each row as an object with property names - * that correspond to the column names returned in the result set. - */ - const FETCH_OBJ = 9; + const ACCESSOR_BOTH = 4; /** diff --git a/lib/Doctrine/Configurable.php b/lib/Doctrine/Configurable.php index b0dd831c4..e2977b814 100644 --- a/lib/Doctrine/Configurable.php +++ b/lib/Doctrine/Configurable.php @@ -93,6 +93,13 @@ abstract class Doctrine_Configurable { case Doctrine::ATTR_CREATE_TABLES: $value = (bool) $value; break; + case Doctrine::ATTR_ACCESSORS: + $accessors = array('none','get','set','both'); + + // if( ! in_array($value,$accessors)) + // throw new Doctrine_Exception(); + + break; case Doctrine::ATTR_COLL_LIMIT: if($value < 1) { throw new Doctrine_Exception("Collection limit should be a value greater than or equal to 1."); @@ -166,7 +173,7 @@ abstract class Doctrine_Configurable { public function setListener($listener) { if( ! ($listener instanceof Doctrine_EventListener_Interface) && ! ($listener instanceof Doctrine_Overloadable)) - throw new Doctrine_DB_Exception("Couldn't set eventlistener. EventListeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable"); + throw new Doctrine_Exception("Couldn't set eventlistener. EventListeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable"); $this->attributes[Doctrine::ATTR_LISTENER] = $listener; @@ -181,7 +188,7 @@ abstract class Doctrine_Configurable { public function getAttribute($attribute) { $attribute = (int) $attribute; - if($attribute < 1 || $attribute > 17) + if($attribute < 1 || $attribute > 18) throw new InvalidKeyException(); if( ! isset($this->attributes[$attribute])) { diff --git a/lib/Doctrine/Connection/Sqlite.php b/lib/Doctrine/Connection/Sqlite.php index 1a38f0024..3706314bc 100644 --- a/lib/Doctrine/Connection/Sqlite.php +++ b/lib/Doctrine/Connection/Sqlite.php @@ -1,7 +1,71 @@ . + */ +Doctrine::autoload("Doctrine_Connection_Common"); +/** + * Doctrine_Connection_Sqlite + * + * @package Doctrine ORM + * @url www.phpdoctrine.com + * @license LGPL */ -class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common { } + +class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common { + /** + * Return string to call a variable with the current timestamp inside an SQL statement + * There are three special variables for current date and time. + * + * @return string sqlite function as string + */ + public function now($type = 'timestamp') { + switch ($type) { + case 'time': + return 'time(\'now\')'; + case 'date': + return 'date(\'now\')'; + case 'timestamp': + default: + return 'datetime(\'now\')'; + } + } + /** + * return string to call a function to get a substring inside an SQL statement + * + * @return string to call a function to get a substring + * @access public + */ + public function substring($value, $position = 1, $length = null) { + if($length !== null) + return "substr($value,$position,$length)"; + + return "substr($value,$position,length($value))"; + } + + /** + * return string to call a function to get random value inside an SQL statement + * + * @return string to generate float between 0 and 1 + */ + public function random() + { + return '((RANDOM() + 2147483648) / 4294967296)'; + } +} diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index 19329d741..e60bfc6bc 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -55,6 +55,8 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera /** * constructor + * + * this is private constructor (use getInstance to get an instance of this class) */ private function __construct() { $this->root = dirname(__FILE__); @@ -137,6 +139,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera * * @param PDO $pdo PDO database driver * @param string $name name of the connection, if empty numeric key is used + * @throws Doctrine_Manager_Exception if trying to bind a connection with an existing name * @return Doctrine_Connection */ public function openConnection(PDO $pdo, $name = null) { @@ -146,7 +149,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera if($name !== null) { $name = (string) $name; if(isset($this->connections[$name])) - throw new Doctrine_Exception("Connection with $name already exists!"); + throw new Doctrine_Manager_Exception("Connection with $name already exists!"); } else { $name = $this->index; @@ -187,7 +190,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera * getConnection * @param integer $index * @return object Doctrine_Connection - * @throws InvalidKeyException + * @throws Doctrine_Manager_Exception if trying to get a non-existent connection */ public function getConnection($name) { if (!isset($this->connections[$name])) { @@ -211,8 +214,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera public function addDSN($dsn, $name) { $this->dataSourceNames[$name] = $dsn; } - public function getSession($index) { return $this->getConnection($index); } - /** * closes the connection * @@ -223,7 +224,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera $connection->close(); unset($connection); } - public function closeSession(Doctrine_Connection $connection) { $this->closeConnection($connection); } /** * getConnections * returns all opened connections @@ -233,9 +233,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera public function getConnections() { return $this->connections; } - public function getSessions() { - return $this->connections; - } /** * setCurrentConnection * sets the current connection to $key @@ -251,9 +248,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera $this->currIndex = $key; } - public function setCurrentSession($key) { - $this->setCurrentConnection($key); - } /** * count * returns the number of opened connections @@ -286,7 +280,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera return $this->connections[$i]; } - public function getCurrentSession() { return $this->getCurrentConnection(); } /** * __toString * returns a string representation of this object diff --git a/lib/Doctrine/Manager/Exception.php b/lib/Doctrine/Manager/Exception.php index af3ca2ca4..9344ab188 100644 --- a/lib/Doctrine/Manager/Exception.php +++ b/lib/Doctrine/Manager/Exception.php @@ -1,5 +1,29 @@ . + */ +/** + * Doctrine_Manager_Exception + * + * @package Doctrine ORM + * @url www.phpdoctrine.com + * @license LGPL + */ class Doctrine_Manager_Exception extends Doctrine_Exception { } - -?> \ No newline at end of file diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index bd62d89cb..f2123a4f5 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -543,7 +543,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { * @param string $e1 the first bracket, usually '(' * @param string $e2 the second bracket, usually ')' */ - public static function bracketTrim($str,$e1,$e2) { + public static function bracketTrim($str,$e1 = '(',$e2 = ')') { if(substr($str,0,1) == $e1 && substr($str,-1) == $e2) return substr($str,1,-1); else diff --git a/lib/Doctrine/Query/From.php b/lib/Doctrine/Query/From.php index ec465d73b..41505f524 100644 --- a/lib/Doctrine/Query/From.php +++ b/lib/Doctrine/Query/From.php @@ -1,5 +1,5 @@ 1) { $field = array_pop($a); $count = count($e); @@ -34,7 +33,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition { if($pos !== false) { $func = substr($field, 0, $pos); - $value = substr($field, ($pos + 1), -1); + $value = trim(substr($field, ($pos + 1), -1)); $values = Doctrine_Query::sqlExplode($value, ','); @@ -75,18 +74,24 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition { $enumIndex = $table->enumIndex($field, trim($value,"'")); $alias = $this->query->getTableAlias($reference); $table = $this->query->getTable($alias); - - if(trim($value) == 'true') + + + if($value == 'true') $value = 1; - elseif(trim($value) == 'false') + elseif($value == 'false') $value = 0; + elseif(substr($value,0,5) == '(FROM') { + $sub = Doctrine_Query::bracketTrim($value); + $q = new Doctrine_Query(); + $value = '(' . $q->parseQuery($sub)->getQuery() . ')'; + } switch($operator) { case '<': case '>': case '=': if($enumIndex !== false) - $value = $enumIndex; + $value = $enumIndex; $where = $alias.'.'.$field.' '.$operator.' '.$value; break; diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 70a8143b1..b730be306 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -585,13 +585,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite * returns the value of a property, if the property is not yet loaded * this method does NOT load it * - * @param $name name of the property + * @param $name name of the property + * @throws Doctrine_Record_Exception if trying to get an unknown property * @return mixed */ public function rawGet($name) { if( ! isset($this->data[$name])) - throw new InvalidKeyException(); + throw new Doctrine_Record_Exception('Unknown property '. $name); if($this->data[$name] === self::$null) return null; @@ -644,7 +645,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite if($this->data[$lower] === self::$null) { $this->load(); } - + if($this->data[$lower] === self::$null) $value = null; else @@ -654,10 +655,15 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite if($value !== self::$null) { - if($invoke && $name !== $this->table->getIdentifier()) { + + $value = $this->table->invokeGet($this, $name, $value); + + if($invoke && $name !== $this->table->getIdentifier()) return $this->table->getAttribute(Doctrine::ATTR_LISTENER)->onGetProperty($this, $name, $value); - } else + else return $value; + + return $value; } @@ -667,7 +673,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite if($name === $this->table->getIdentifier()) return null; - $rel = $this->table->getRelation($name); + $rel = $this->table->getRelation($name); try { if( ! isset($this->references[$name])) @@ -711,10 +717,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite $old = $this->data[$lower]; if($old !== $value) { - - // invoke the onPreSetProperty listener - $value = $this->table->getAttribute(Doctrine::ATTR_LISTENER)->onSetProperty($this, $name, $value); + $value = $this->table->invokeSet($this, $name, $value); + + $value = $this->table->getAttribute(Doctrine::ATTR_LISTENER)->onSetProperty($this, $name, $value); + if($value === null) $value = self::$null; diff --git a/lib/Doctrine/Table.php b/lib/Doctrine/Table.php index f3fd9bc22..6b82f5870 100644 --- a/lib/Doctrine/Table.php +++ b/lib/Doctrine/Table.php @@ -945,6 +945,40 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable { final public function enumValue($field, $index) { return isset($this->enum[$field][$index])?$this->enum[$field][$index]:$index; } + /** + * invokeSet + * + * @param mixed $value + */ + public function invokeSet(Doctrine_Record $record, $name, $value) { + if( ! ($this->getAttribute(Doctrine::ATTR_ACCESSORS) | Doctrine::ACCESSOR_SET)) + return $value; + + $method = 'set' . $name; + + if(method_exists($record, $method)) { + return $record->$method($value); + } + + return $value; + } + /** + * invokeGet + * + * @param mixed $value + */ + public function invokeGet(Doctrine_Record $record, $name, $value) { + if( ! ($this->getAttribute(Doctrine::ATTR_ACCESSORS) | Doctrine::ACCESSOR_GET)) + return $value; + + $method = 'get' . $name; + + if(method_exists($record, $method)) { + return $record->$method($value); + } + + return $value; + } /** * enumIndex * @@ -961,7 +995,20 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable { return array_search($value, $values); } /** - * @return integer + * getDefinitionOf + * + * @return string ValueWrapper class name on success, false on failure + */ + public function getValueWrapperOf($column) { + if(isset($this->columns[$column][2]['wrapper'])) + return $this->columns[$column][2]['wrapper']; + + return false; + } + /** + * getColumnCount + * + * @return integer the number of columns in this table */ final public function getColumnCount() { return $this->columnCount; diff --git a/manual/docs/DQL (Doctrine Query Language) - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - Introduction.php index 578aee195..faa29ca83 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Introduction.php +++ b/manual/docs/DQL (Doctrine Query Language) - Introduction.php @@ -17,3 +17,31 @@ When compared to using raw SQL, DQL has several benefits:
If the power of DQL isn't enough, you should consider using the rawSql API for object population. + +Standard DQL query consists of the following parts: + + + + + +
+In BNF syntax, a select statement is defined as: + select_statement :: = select_clause from_clause [where_clause] [groupby_clause] + [having_clause] [orderby_clause] +
+A select statement must always have a SELECT and a FROM clause. The square brackets [] indicate +that the other clauses are optional. diff --git a/manual/docs/Getting started - Setting table definition - Table and class naming.php b/manual/docs/Getting started - Setting table definition - Table and class naming.php index aab05b40a..4aa8d9883 100644 --- a/manual/docs/Getting started - Setting table definition - Table and class naming.php +++ b/manual/docs/Getting started - Setting table definition - Table and class naming.php @@ -3,6 +3,15 @@ Doctrine automatically creates table names from the record class names. For this
  • Use CamelCase naming
  • Underscores are allowed
  • The first letter must be capitalized
  • +
  • The class name cannot be one of the following (these keywords are reserved in DQL API):
    + SELECT, FROM, WHERE, UPDATE, DELETE, JOIN, OUTER, INNER, LEFT, GROUP, ORDER, BY, HAVING,
    + FETCH, DISTINCT, OBJECT, NULL, TRUE, FALSE,
    + NOT, AND, OR, BETWEEN, LIKE, IN,
    + AS, UNKNOWN, EMPTY, MEMBER, OF, IS, ASC, DESC,
    + AVG, MAX, MIN, SUM, COUNT,
    + MOD, UPPER, LOWER, TRIM, POSITION,
    + CHARACTER_LENGTH, CHAR_LENGTH, BIT_LENGTH, CURRENT_TIME, CURRENT_DATE,
    + CURRENT_TIMESTAMP, NEW, EXISTS, ALL, ANY, SOME.
  • Example. My_PerfectClass
    diff --git a/manual/documentation.php b/manual/documentation.php index 9183af56b..148db4c49 100644 --- a/manual/documentation.php +++ b/manual/documentation.php @@ -306,18 +306,37 @@ $menu = array("Getting started" => ), "DQL (Doctrine Query Language)" => - array('Introduction', - 'Syntax' => - - array( - 'FROM', - 'WHERE', - 'GROUP BY', - 'HAVING', - 'ORDER BY', - 'LIMIT and OFFSET', - ), + array('Introduction', + 'FROM clause', + 'WHERE clause', + 'Conditional expressions' => + array('Literals', + 'Identification variables', + 'Path expressions', + 'Input parameters', + 'Contidional expression composition', + 'Operators and operator precedence', + 'Between expressions', + 'In expressions', + 'Like Expressions', + 'Null Comparison Expressions', + 'Empty Collection Comparison Expressions', + 'Collection Member Expressions', + 'Exists Expressions', + 'All or Any Expressions', + 'Subqueries'), + 'Functional Expressions' => + array('String functions', + 'Arithmetic functions', + 'Datetime functions', + 'Collection functions'), + 'GROUP BY, HAVING clauses', + 'ORDER BY clause', + 'LIMIT and OFFSET clauses', + 'Examples', + 'BNF'), + /** 'Functions' => array( 'Contains', 'Regexp', @@ -326,8 +345,8 @@ $menu = array("Getting started" => 'Logical operators') + */ - ), "Transactions" => array( "Introduction", "Unit of work", diff --git a/tests/EventListenerTestCase.php b/tests/EventListenerTestCase.php index 6ca1e3215..9f19866ef 100644 --- a/tests/EventListenerTestCase.php +++ b/tests/EventListenerTestCase.php @@ -39,45 +39,7 @@ class Doctrine_EventListener_TestLogger implements Doctrine_Overloadable, Counta class Doctrine_EventListenerTestCase extends Doctrine_UnitTestCase { private $logger; - public function testAccessorInvoker() { - $e = new EventListenerTest; - $e->name = "something"; - $e->password = "123"; - - $this->assertEqual($e->get('name'), 'SOMETHING'); - // test repeated calls - $this->assertEqual($e->get('name'), 'SOMETHING'); - $this->assertEqual($e->id, null); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $e->save(); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $this->connection->clear(); - - $e->refresh(); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $this->connection->clear(); - - $e = $e->getTable()->find($e->id); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - } public function testSetListener() { $this->logger = new Doctrine_EventListener_TestLogger(); @@ -85,6 +47,9 @@ class Doctrine_EventListenerTestCase extends Doctrine_UnitTestCase { $e->getTable()->setListener($this->logger); + $e->name = 'listener'; + $e->save(); + $this->assertEqual($e->getTable()->getListener(), $this->logger); } public function testOnLoad() { @@ -94,6 +59,7 @@ class Doctrine_EventListenerTestCase extends Doctrine_UnitTestCase { $e = $this->connection->getTable('EventListenerTest')->find(1); + $this->assertEqual($e->getTable()->getListener(), $this->logger); $this->assertEqual($this->logger->pop(), 'onLoad'); diff --git a/tests/QuerySubqueryTestCase.php b/tests/QuerySubqueryTestCase.php new file mode 100644 index 000000000..60fe463f6 --- /dev/null +++ b/tests/QuerySubqueryTestCase.php @@ -0,0 +1,16 @@ +from('User')->where("User.id NOT IN (FROM User(id) WHERE User.name = 'zYne')"); + + $this->assertEqual($q->getQuery(), + "SELECT entity.id AS entity__id, entity.name AS entity__name, entity.loginname AS entity__loginname, entity.password AS entity__password, entity.type AS entity__type, entity.created AS entity__created, entity.updated AS entity__updated, entity.email_id AS entity__email_id FROM entity WHERE entity.id NOT IN (SELECT entity.id AS entity__id FROM entity WHERE entity.name = 'zYne' AND (entity.type = 0)) AND (entity.type = 0)"); + + $users = $q->execute(); + + $this->assertEqual($users->count(), 7); + $this->assertEqual($users[0]->name, 'Arnold Schwarzenegger'); + } +} +?> diff --git a/tests/RecordFilterTestCase.php b/tests/RecordFilterTestCase.php new file mode 100644 index 000000000..ee6a50ae7 --- /dev/null +++ b/tests/RecordFilterTestCase.php @@ -0,0 +1,63 @@ +setAttribute(Doctrine::ATTR_ACCESSORS, Doctrine::ACCESSOR_BOTH); + + $this->hasColumn("name", "string", 200); + $this->hasColumn("password", "string", 32); + } + public function setPassword($password) { + return md5($password); + } + public function getName($name) { + return strtoupper($name); + } +} + + +class Doctrine_Record_Filter_TestCase extends Doctrine_UnitTestCase { + public function prepareData() { } + public function prepareTables() { } + + public function testValueWrapper() { + $e = new RecordFilterTest; + $e->name = "something"; + $e->password = "123"; + + + $this->assertEqual($e->get('name'), 'SOMETHING'); + // test repeated calls + $this->assertEqual($e->get('name'), 'SOMETHING'); + $this->assertEqual($e->id, null); + $this->assertEqual($e->rawGet('name'), 'something'); + $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); + + $e->save(); + + $this->assertEqual($e->id, 1); + $this->assertEqual($e->name, 'SOMETHING'); + $this->assertEqual($e->rawGet('name'), 'something'); + $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); + + $this->connection->clear(); + + $e->refresh(); + + $this->assertEqual($e->id, 1); + $this->assertEqual($e->name, 'SOMETHING'); + $this->assertEqual($e->rawGet('name'), 'something'); + $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); + + $this->connection->clear(); + + $e = $e->getTable()->find($e->id); + + $this->assertEqual($e->id, 1); + $this->assertEqual($e->name, 'SOMETHING'); + $this->assertEqual($e->rawGet('name'), 'something'); + $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); + + } +} +?> diff --git a/tests/run.php b/tests/run.php index 919a37846..ecd43f696 100644 --- a/tests/run.php +++ b/tests/run.php @@ -10,7 +10,10 @@ require_once("TableTestCase.php"); require_once("EventListenerTestCase.php"); require_once("BatchIteratorTestCase.php"); require_once("CacheFileTestCase.php"); + require_once("RecordTestCase.php"); +require_once("RecordFilterTestCase.php"); + require_once("AccessTestCase.php"); require_once("ValidatorTestCase.php"); require_once("CollectionTestCase.php"); @@ -32,6 +35,7 @@ require_once("QueryReferenceModelTestCase.php"); require_once("QueryWhereTestCase.php"); require_once("QueryConditionTestCase.php"); require_once("QueryComponentAliasTestCase.php"); +require_once("QuerySubqueryTestCase.php"); require_once("DBTestCase.php"); require_once("SchemaTestCase.php"); @@ -117,6 +121,9 @@ $test->addTestCase(new Doctrine_EnumTestCase()); $test->addTestCase(new Doctrine_Query_ComponentAlias_TestCase()); +$test->addTestCase(new Doctrine_Query_Subquery_TestCase()); + +$test->addTestCase(new Doctrine_Record_Filter_TestCase()); //$test->addTestCase(new Doctrine_Cache_FileTestCase()); //$test->addTestCase(new Doctrine_Cache_SqliteTestCase());