Changeset 3945

Show
Ignore:
Timestamp:
03/08/08 03:26:14 (16 months ago)
Author:
jwage
Message:

A few cosmetic fixes. Fixed test cases.

Location:
branches/0.10
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Query.php

    r3928 r3945  
    397397            return $this->getSqlAggregateAlias($dqlAlias); 
    398398        } else { 
    399              throw new Doctrine_Query_Exception('Unknown aggregate alias: ' . $dqlAlias); 
     399            throw new Doctrine_Query_Exception('Unknown aggregate alias: ' . $dqlAlias); 
    400400        } 
    401401    } 
     
    14351435    public function load($path, $loadFields = true) 
    14361436    { 
    1437         if (isset($this->_queryComponents[$path])) { 
    1438            return $this->_queryComponents[$path]; 
    1439         } 
     1437        if (isset($this->_queryComponents[$path])) { 
     1438            return $this->_queryComponents[$path]; 
     1439        } 
     1440 
    14401441        $e = $this->_tokenizer->quoteExplode($path, ' INDEXBY '); 
    14411442 
  • branches/0.10/lib/Doctrine/Table.php

    r3885 r3945  
    246246     */ 
    247247    public function initDefinition() 
    248     {         
     248    { 
    249249        $name = $this->_options['name']; 
    250250        if ( ! class_exists($name) || empty($name)) { 
  • branches/0.10/tests/DoctrineTest/GroupTest.php

    r2999 r3945  
    5050            } catch(Exception $e) { 
    5151                $this->_failed += 1; 
    52                 $this->_messages[] = 'Unexpected exception thrown with message [' . $e->getMessage() . '] in ' . $e->getFile() . ' on line ' . $e->getLine(); 
     52                $this->_messages[] = 'Unexpected exception thrown in [' . get_class($testCase) . '] with message [' . $e->getMessage() . '] in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n\nTrace\n-------------\n\n" . $e->getTraceAsString();; 
     53                 
    5354            } 
    5455            $this->_passed += $testCase->getPassCount(); 
  • branches/0.10/tests/Query/AggregateValueTestCase.php

    r3884 r3945  
    146146        $q = new Doctrine_Query(); 
    147147 
    148         $q->select('MAX(u.name)')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); 
    149  
    150         $this->assertEqual($q->getQuery(), 'SELECT MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id'); 
     148        $q->select('MAX(u.name), u.*, p.*')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); 
     149 
     150        $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id'); 
    151151        $users = $q->execute(); 
    152152 
     
    181181    { 
    182182        $q = new Doctrine_Query(); 
    183         $func = $q->from('QueryTest_Item i')->parseFunctionExpression('SUM(i.price)'); 
    184      
    185         $this->assertEqual($func, 'SUM(i.price)'); 
     183        $q->select('SUM(i.price)')->from('QueryTest_Item i'); 
     184 
     185        $this->assertEqual($q->getSql(), 'SELECT SUM(q.price) AS q__0 FROM query_test__item q'); 
    186186    } 
    187187    public function testAggregateFunctionParser2() 
    188188    { 
    189189        $q = new Doctrine_Query(); 
    190         $func = $q->from('QueryTest_Item i')->parseFunctionExpression('SUM(i.price * i.quantity)'); 
    191  
    192         $this->assertEqual($func, 'SUM(i.price * i.quantity)'); 
     190        $q->select('SUM(i.price * i.quantity)')->from('QueryTest_Item i'); 
     191 
     192        $this->assertEqual($q->getSql(), 'SELECT SUM(q.price * q.quantity) AS q__0 FROM query_test__item q'); 
    193193    } 
    194194    public function testAggregateFunctionParser3() 
    195195    { 
    196196        $q = new Doctrine_Query(); 
    197         $func = $q->from('QueryTest_Item i')->parseFunctionExpression('MOD(i.price, i.quantity)'); 
    198  
    199         $this->assertEqual($func, 'MOD(i.price, i.quantity)'); 
     197        $q->select('MOD(i.price, i.quantity)')->from('QueryTest_Item i'); 
     198 
     199        $this->assertEqual($q->getSql(), 'SELECT MOD(q.price, q.quantity) AS q__0 FROM query_test__item q'); 
    200200    } 
    201201    public function testAggregateFunctionParser4() 
    202202    { 
    203203        $q = new Doctrine_Query(); 
    204         $func = $q->from('QueryTest_Item i')->parseFunctionExpression('CONCAT(i.price, i.quantity)'); 
    205  
    206         $this->assertEqual($func, 'CONCAT(i.price, i.quantity)'); 
     204        $q->select('CONCAT(i.price, i.quantity)')->from('QueryTest_Item i'); 
     205 
     206        $this->assertEqual($q->getSql(), 'SELECT CONCAT(q.price, q.quantity) AS q__0 FROM query_test__item q'); 
    207207    } 
    208208    public function testAggregateFunctionParsingSupportsMultipleComponentReferences() 
     
    211211        $q->select('SUM(i.price * i.quantity)') 
    212212          ->from('QueryTest_Item i'); 
    213            
     213 
    214214        $this->assertEqual($q->getQuery(), "SELECT SUM(q.price * q.quantity) AS q__0 FROM query_test__item q"); 
    215215    } 
    216  
    217  
    218216} 
  • branches/0.10/tests/run.php

    r3916 r3945  
    186186// Query tests 
    187187$query_tests = new GroupTest('Query tests','query_test'); 
     188$query_tests->addTestCase(new Doctrine_Query_TestCase()); 
    188189$query_tests->addTestCase(new Doctrine_Query_Condition_TestCase()); 
    189190$query_tests->addTestCase(new Doctrine_Query_MultiJoin_TestCase());