@@ -140,7 +158,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -140,7 +158,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->query("FROM User-b WHERE User.Group.name = 'Action Actors'");
$users=$query->query("FROM User-b WHERE User.Group.name = 'Action Actors'");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id WHERE (entity2.name = 'Action Actors') AND (entity.type = 0 AND (entity2.type = 1 OR entity2.type IS NULL))");
"SELECT entity.id AS entity__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id WHERE (entity2.name = 'Action Actors') AND (entity.type = 0 AND (entity2.type = 1 OR entity2.type IS NULL))");
@@ -149,7 +167,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -149,7 +167,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->query("FROM User-b WHERE User.Group.Phonenumber.phonenumber LIKE '123 123'");
$users=$query->query("FROM User-b WHERE User.Group.Phonenumber.phonenumber LIKE '123 123'");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id LEFT JOIN phonenumber ON entity2.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '123 123') AND (entity.type = 0 AND (entity2.type = 1 OR entity2.type IS NULL))");
"SELECT entity.id AS entity__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id LEFT JOIN phonenumber ON entity2.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '123 123') AND (entity.type = 0 AND (entity2.type = 1 OR entity2.type IS NULL))");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS Forum_Board__id, forum_thread.id AS Forum_Thread__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS forum_board__id, forum_thread.id AS forum_thread__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id");
$coll=$q->execute();
$coll=$q->execute();
$this->assertEqual($coll->count(),1);
$this->assertEqual($coll->count(),1);
$q->from("Forum_Board-l.Threads-l");
$q->from("Forum_Board-l.Threads-l");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS Forum_Board__id, forum_thread.id AS Forum_Thread__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS forum_board__id, forum_thread.id AS forum_thread__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id");
//$this->session->clear();
//$this->session->clear();
$q->from("Forum_Board-l.Threads-l.Entries-l");
$q->from("Forum_Board-l.Threads-l.Entries-l");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS Forum_Board__id, forum_thread.id AS Forum_Thread__id, forum_entry.id AS Forum_Entry__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id LEFT JOIN forum_entry ON forum_thread.id = forum_entry.thread_id");
$this->assertEqual($q->getQuery(),"SELECT forum_board.id AS forum_board__id, forum_thread.id AS forum_thread__id, forum_entry.id AS forum_entry__id FROM forum_board LEFT JOIN forum_thread ON forum_board.id = forum_thread.board_id LEFT JOIN forum_entry ON forum_thread.id = forum_entry.thread_id");
$boards=$q->execute();
$boards=$q->execute();
$this->assertEqual($boards->count(),1);
$this->assertEqual($boards->count(),1);
$count=count($this->dbh);
$count=count($this->dbh);
...
@@ -845,7 +852,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -845,7 +852,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->execute();
$users=$query->execute();
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN email ON entity.email_id = email.id WHERE (entity.type = 0) ORDER BY entity.name ASC, email.address");
"SELECT entity.id AS entity__id FROM entity LEFT JOIN email ON entity.email_id = email.id WHERE (entity.type = 0) ORDER BY entity.name ASC, email.address");
@@ -937,7 +944,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -937,7 +944,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->query("FROM User-b.Phonenumber-l WHERE User.Phonenumber.phonenumber LIKE '%123%'");
$users=$query->query("FROM User-b.Phonenumber-l WHERE User.Phonenumber.phonenumber LIKE '%123%'");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id, phonenumber.id AS Phonenumber__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '%123%') AND (entity.type = 0)");
"SELECT entity.id AS entity__id, phonenumber.id AS phonenumber__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '%123%') AND (entity.type = 0)");
$count=$this->session->getDBH()->count();
$count=$this->session->getDBH()->count();
...
@@ -963,7 +970,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -963,7 +970,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->query("FROM User-i");
$users=$query->query("FROM User-i");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id, entity.name AS User__name, entity.loginname AS User__loginname, entity.password AS User__password, entity.type AS User__type, entity.created AS User__created, entity.updated AS User__updated, entity.email_id AS User__email_id FROM entity WHERE (entity.type = 0)");
"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.type = 0)");
$count=$this->session->getDBH()->count();
$count=$this->session->getDBH()->count();
$this->assertEqual($users[0]->name,"zYne");
$this->assertEqual($users[0]->name,"zYne");
...
@@ -980,7 +987,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -980,7 +987,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
"SELECT entity.id AS User__id, phonenumber.id AS Phonenumber__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (entity.type = 0)");
"SELECT entity.id AS entity__id, phonenumber.id AS phonenumber__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (entity.type = 0)");
$this->assertEqual($users->count(),8);
$this->assertEqual($users->count(),8);
...
@@ -997,24 +1004,24 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -997,24 +1004,24 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$users=$query->query("FROM User-l:Email-b");
$users=$query->query("FROM User-l:Email-b");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id, email.id AS Email__id FROM entity INNER JOIN email ON entity.email_id = email.id WHERE (entity.type = 0)");
"SELECT entity.id AS entity__id, email.id AS email__id FROM entity INNER JOIN email ON entity.email_id = email.id WHERE (entity.type = 0)");
$this->assertEqual($users->count(),8);
$this->assertEqual($users->count(),8);
$users=$query->query("FROM Email-b WHERE Email.address LIKE '%@example%'");
$users=$query->query("FROM Email-b WHERE Email.address LIKE '%@example%'");
$this->assertEqual($query->getQuery(),
$this->assertEqual($query->getQuery(),
"SELECT email.id AS Email__id FROM email WHERE (email.address LIKE '%@example%')");
"SELECT email.id AS email__id FROM email WHERE (email.address LIKE '%@example%')");
$this->assertEqual($users->count(),8);
$this->assertEqual($users->count(),8);
$users=$query->query("FROM User-b WHERE User.name LIKE '%Jack%'");
$users=$query->query("FROM User-b WHERE User.name LIKE '%Jack%'");
$this->assertEqual($query->getQuery(),"SELECT entity.id AS User__id FROM entity WHERE (entity.name LIKE '%Jack%') AND (entity.type = 0)");
$this->assertEqual($query->getQuery(),"SELECT entity.id AS entity__id FROM entity WHERE (entity.name LIKE '%Jack%') AND (entity.type = 0)");
$this->assertEqual($users->count(),0);
$this->assertEqual($users->count(),0);
$users=$query->query("FROM User-b WHERE User.Phonenumber.phonenumber LIKE '%123%'");
$users=$query->query("FROM User-b WHERE User.Phonenumber.phonenumber LIKE '%123%'");
$this->assertEqual(trim($query->getQuery()),
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '%123%') AND (entity.type = 0)");
"SELECT entity.id AS entity__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '%123%') AND (entity.type = 0)");
$this->assertEqual($users->count(),5);
$this->assertEqual($users->count(),5);
...
@@ -1025,5 +1032,6 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
...
@@ -1025,5 +1032,6 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {