Development

Changeset 1315

You must first sign up to be able to contribute.

Changeset 1315

Show
Ignore:
Timestamp:
05/04/06 12:53:25 (3 years ago)
Author:
francois
Message:

documented database initialization for unit tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/doc/book/content/test_unit_testing.txt

    r850 r1315  
    112112>**Note**: The extensive list of the `assert` methods can be found in the [Simple Test documentation][3]. 
    113113 
     114### Unit tests accessing the database 
     115 
     116If you want to include unit tests which need a connection to the database, initialize it in the `setUp()` method as follows: 
     117 
     118    [php] 
     119    public function setUp () 
     120    { 
     121      // initialize the database manager 
     122      $databaseManager = new sfDatabaseManager(); 
     123      $databaseManager->initialize(); 
     124    } 
     125 
     126You can then use the database connections and Propel objects just like in actions. 
     127     
    114128### Running unit tests 
    115129