Changeset 4561

Show
Ignore:
Timestamp:
06/25/08 18:22:32 (12 months ago)
Author:
jwage
Message:

adding coverage for #1170

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/tests/SoftDeleteTestCase.php

    r4518 r4561  
    8383        $this->assertEqual($results->count(), 1); 
    8484    } 
     85 
     86    // Test Doctrine_Query::count() applies dql hooks 
     87    public function testTicket1170() 
     88    { 
     89        $orig = Doctrine_Manager::getInstance()->getAttribute('use_dql_callbacks'); 
     90 
     91        Doctrine_Manager::getInstance()->setAttribute('use_dql_callbacks', true); 
     92 
     93        $q = Doctrine_Query::create() 
     94                ->from('SoftDeleteTest s') 
     95                ->addWhere('s.name = ?', 'test1') 
     96                ->addWhere('s.something = ?', 'test2'); 
     97 
     98        $this->assertEqual($q->getCountQuery(), 'SELECT COUNT(DISTINCT s.name) AS num_results FROM soft_delete_test s WHERE s.name = ? AND s.something = ? AND s.deleted = ? GROUP BY s.name'); 
     99        $this->assertEqual($q->count(), 0); 
     100 
     101        Doctrine_Manager::getInstance()->setAttribute('use_dql_callbacks', $orig); 
     102    } 
    85103}