Show
Ignore:
Timestamp:
02/03/08 21:29:57 (11 months ago)
Author:
romanb
Message:

Merged r3518:r3700 from branch to trunk. Branch to be deleted, soon. Development continues in trunk.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/DoctrineTest/Doctrine_UnitTestCase.php

    r3460 r3701  
    6666        $this->_name = get_class($this); 
    6767 
    68         $this->manager   = Doctrine_Manager::getInstance(); 
     68        $this->manager = Doctrine_Manager::getInstance(); 
    6969        $this->manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); 
    7070 
    7171        $this->tables = array_merge($this->tables,  
    72                         array('entity', 
    73                               'entityReference', 
    74                               'email', 
    75                               'phonenumber', 
    76                               'groupuser', 
    77                               'album', 
    78                               'song', 
    79                               'element', 
    80                               'error', 
    81                               'description', 
    82                               'address', 
    83                               'account', 
    84                               'task', 
    85                               'resource', 
    86                               'assignment', 
    87                               'resourceType', 
    88                               'resourceReference') 
     72                        array('Entity', 
     73                              'EntityReference', 
     74                              'Email', 
     75                              'Phonenumber', 
     76                              'Groupuser', 
     77                              'Album', 
     78                              'Book', 
     79                              'Song', 
     80                              'Element', 
     81                              'Error', 
     82                              'Description', 
     83                              'Address', 
     84                              'Account', 
     85                              'Task', 
     86                              'Resource', 
     87                              'Assignment', 
     88                              'ResourceType', 
     89                              'ResourceReference') 
    8990                              ); 
    9091 
    9192 
    9293        $class = get_class($this); 
    93         $e     = explode('_', $class); 
     94        $e = explode('_', $class); 
    9495 
    9596 
     
    135136            $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener); 
    136137 
    137         } catch(Doctrine_Manager_Exception $e) { 
     138        } catch (Doctrine_Manager_Exception $e) { 
    138139            if($this->driverName == 'main') { 
    139140                $this->dbh = new PDO('sqlite::memory:'); 
     
    145146            $this->conn = $this->connection = $this->manager->openConnection($this->dbh, $this->driverName); 
    146147 
    147             if($this->driverName !== 'main') { 
     148            if ($this->driverName !== 'main') { 
    148149                $exc  = 'Doctrine_Connection_' . ucwords($this->driverName) . '_Exception'; 
    149150 
     
    156157            $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener); 
    157158        } 
     159         
    158160        if ($this->driverName !== 'main') { 
    159  
    160161            if (isset($module)) { 
    161162                switch($module) { 
     
    175176            } 
    176177        } 
     178         
    177179        $this->unitOfWork = $this->connection->unitOfWork; 
    178180        $this->connection->setListener(new Doctrine_EventListener()); 
    179181        $this->query = new Doctrine_Query($this->connection); 
    180  
     182         
    181183        if ($this->driverName === 'main') { 
    182184            $this->prepareTables(); 
     
    184186        } 
    185187    } 
     188     
    186189    public function prepareTables() { 
    187         foreach($this->tables as $name) { 
    188             $name = ucwords($name); 
    189             $table = $this->connection->getTable($name); 
     190        foreach ($this->tables as $name) { 
     191            $table = $this->connection->getMetadata($name); 
    190192            $query = 'DROP TABLE ' . $table->getTableName(); 
    191193            try { 
    192194                $this->conn->exec($query); 
    193             } catch(Doctrine_Connection_Exception $e) { 
    194  
    195             } 
    196         } 
     195            } catch (Doctrine_Connection_Exception $e) {} 
     196        } 
     197        //echo "exporting : " . var_dump($this->tables); 
     198        //echo "<br /><br />"; 
    197199        $this->conn->export->exportClasses($this->tables); 
    198200        $this->objTable = $this->connection->getMapper('User'); 
    199201    } 
     202     
    200203    public function prepareData()  
    201204    { 
     
    256259        $this->users->save();  
    257260    } 
     261     
    258262    public function getConnection()  
    259263    { 
    260264        return $this->connection; 
    261265    } 
     266     
    262267    public function assertDeclarationType($type, $type2)  
    263268    { 
     
    270275        $this->assertEqual($dec['type'], $type2); 
    271276    } 
     277     
    272278    public function getDeclaration($type)  
    273279    { 
    274280        return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 1, 'fixed' => true)); 
    275281    } 
     282     
    276283    public function clearCache()  
    277284    { 
     
    281288        } 
    282289    } 
     290     
    283291    public function setUp() 
    284292    { 
     
    286294            $this->init(); 
    287295        } 
     296         
    288297        if (isset($this->objTable)) { 
    289298            $this->objTable->clear();