4.7.1.1 Installing SimpleTest

Installing SimpleTest

The testing framework provided with CakePHP 1.2 is built upon the SimpleTest testing framework. SimpleTest is not shipped with the default CakePHP installation, so we need to download it first. You can find it here: http://simpletest.sourceforge.net/.

Fetch the latest version, and unzip the code to your vendors folder, or your app/vendors folder, depending on your preference. You should now have a vendors/simpletest directory with all SimpleTest files and folders inside. Remember to have a DEBUG level of at least 1 in your app/config/core.php file before running any tests!

If you have no test database connection defined in your app/config/database.php, test tables will be created with a test_suite_ prefix. You can create a $test database connection to contain any test tables like the one below:

	var $test = array(
		'driver' => 'mysql',
		'persistent' => false,
		'host' => 'dbhost',
		'login' => 'dblogin',
		'password' => 'dbpassword',
		'database' => 'databaseName'
	);
  1. var $test = array(
  2. 'driver' => 'mysql',
  3. 'persistent' => false,
  4. 'host' => 'dbhost',
  5. 'login' => 'dblogin',
  6. 'password' => 'dbpassword',
  7. 'database' => 'databaseName'
  8. );

If the test database is available and CakePHP can connect to it, all tables will be created in this database.