Jump to content

Using a test database

From NusaATK
Revision as of 08:48, 16 November 2006 by Peter (talk | contribs)

ATK Howto: Using a test database

Complexity: Intermediate
Author: Peter C. Verhage <peter@ibuildings.nl>

List of other Howto's

Preface

Coming soon...

Configuration

You first need to configure a test database. You can do so by creating an entry called "test" in the $config_db section of the ATK configuration file. It might look like the following:

$config_db["test"]["driver"]                 = "mysqli";
$config_db["test"]["host"]                   = "localhost";
$config_db["test"]["db"]                     = "demo_test";
$config_db["test"]["user"]                   = "user";
$config_db["test"]["password"]               = "password"; 
$config_db["test"]["transactional_fixtures"] = true; 

Nothing out of the ordinary, except for the "transactional_fixtures" configuration option. This new option makes it possible to specify if your database supports transactions or not. This way the system knows it can clean-up the database using a simple rollback instead of having to delete all the data. If you don't specify this option ATK assumes by default that your database doesn't support transactions. You don't need to create any table in the test database, ATK will clone the database structure from the default database.

Warning: make sure that you really specify your test database for the "db" option else you might end up with an empty development or, even worse, an empty production database.

Creating a test case

Coming soon...

Creating fixtures

Coming soon...