1
0
mirror of synced 2025-01-17 22:11:41 +03:00
This commit is contained in:
zYne 2007-06-18 22:21:19 +00:00
parent e40a541b17
commit 4346c9f818
4 changed files with 20 additions and 7 deletions

View File

@ -42,8 +42,8 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase
parent::prepareTables();
}
public function testLimitWithOneToOneLeftJoin()
/**
public function testLimitWithOneToOneLeftJoin()
{
$q = new Doctrine_Query();
$q->select('u.id, e.*')->from('User u, u.Email e')->limit(5);
@ -53,7 +53,7 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id, e2.address AS e2__address FROM entity e LEFT JOIN email e2 ON e.email_id = e2.id WHERE (e.type = 0) LIMIT 5");
}
public function testLimitWithOneToOneInnerJoin()
public function testLimitWithOneToOneInnerJoin()
{
$q = new Doctrine_Query();
$q->select('u.id, e.*')->from('User u, u:Email e')->limit(5);
@ -62,6 +62,7 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($users->count(), 5);
$this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id, e2.address AS e2__address FROM entity e INNER JOIN email e2 ON e.email_id = e2.id WHERE (e.type = 0) LIMIT 5");
}
*/
public function testLimitWithOneToManyLeftJoin()
{
$q = new Doctrine_Query();
@ -251,7 +252,7 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase
$this->connection->clear();
$q = new Doctrine_Query();
$q->from('User')->where('User.Group.id = ?')->orderby('User.id DESC')->limit(5);
$q->from('User')->where('User.Group.id = ?')->orderby('User.id DESC')->limit(5);
$users = $q->execute(array(12));
$this->assertEqual($users->count(), 3);

View File

@ -91,7 +91,8 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase
$query->select('u.*, COUNT(DISTINCT a.id) num_albums');
$query->from('User u, u.Album a');
$query->orderby('num_albums');
try{
// this causes getLimitSubquery() to be used, and it fails
$query->limit(5);

View File

@ -33,6 +33,7 @@
*/
class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase
{
public function testUpdateAllWithColumnAggregationInheritance()
{
$q = new Doctrine_Query();
@ -47,6 +48,7 @@ class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone' WHERE (type = 0)");
}
public function testUpdateWorksWithMultipleColumns()
{
$q = new Doctrine_Query();
@ -61,6 +63,7 @@ class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone', email_id = 5 WHERE (type = 0)");
}
public function testUpdateSupportsConditions()
{
$q = new Doctrine_Query();

View File

@ -34,8 +34,8 @@
class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase
{
public function prepareData() { }
public function prepareTables() {
$this->tables = array('Entity', 'EnumTest');
public function prepareTables() {
$this->tables = array('Entity', 'EnumTest', 'GroupUser');
parent::prepareTables();
}
@ -237,6 +237,8 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase
$q->select('e.*')->from('EnumTest e')->where('e.status = ?');
$q->getQuery();
$this->assertEqual(count($q->getEnumParams()), 1);
$q->execute(array('verified'));
@ -246,6 +248,9 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase
$q = new Doctrine_Query();
$q->select('e.*')->from('EnumTest e')->where('e.id = ? AND e.status = ?');
$q->getQuery();
$p = $q->getEnumParams();
$this->assertEqual(array_keys($p), array(0, 1));
$this->assertTrue(empty($p[0]));
@ -256,6 +261,9 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase
$q = new Doctrine_Query();
$q->select('e.*')->from('EnumTest e')->where('e.id = :id AND e.status = :status');
$q->getQuery();
$p = $q->getEnumParams();
$this->assertEqual(array_keys($p), array(':id', ':status'));
$this->assertTrue(empty($p[':id']));