Last active
December 19, 2015 21:39
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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