Skip to content

Instantly share code, notes, and snippets.

@raultm
Last active December 19, 2015 21:39
Show Gist options
  • Save raultm/6022023 to your computer and use it in GitHub Desktop.
Save raultm/6022023 to your computer and use it in GitHub Desktop.
CakeTestSuite with setup to load sql file in test configuration before start Reference: http://stackoverflow.com/questions/8496921/how-to-prevent-fixtures-from-being-reloaded-between-tests-with-cakephp-and-phpun
<?php
require_once(CORE_PATH . 'Cake/Model/ConnectionManager.php');
class ExampleTestData extends CakeTestSuite {
public static function suite() {
self::loadDB();
$suite = new CakeTestSuite('Name Of The Suite');
$suite->addTestDirectory(TESTS . 'Case' . DS . 'Sample');
return $suite;
}
public static function loadDB() {
$testDbConnction = ConnectionManager::getDataSource('test');
$testDbConnction->rawQuery(file_get_contents(WWW_ROOT . 'test' . DS . 'dump.sql'));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment